Wednesday, August 10, 2022

Mom's Memories







On the 10th Death Anniversary of my mother Nirmala, I would like to write a blog to share some important phases / memories / events of her life. It has been a long time since I wrote a blog but will try to keep it interesting. 

1. Privileged Childhood 
Childhood Pic

Being the youngest girl child of 8 siblings, she was always treated as a child through out her life, her nick name was Chinna Ammayi (Little Girl). She could only managed to get to 7th standard, but she was able to read/write/speak Telugu fluently, and some broken Hindi as well.

She may not have born with silver spoon but was one of the few Privileged people in India, who travelled in flight, "Flying in air" was a rare stuff at that point of time. Irony is that me or my dad could never get her on to flight again.
Childhood Trip

2. Wedding Transition 

    a. On April 8th 1982, she had an important day of her life , and she got married to my father.


Wedding Pic
    
    b. My father had always been great support to her in all the situations.
    
    c. Life was not so easy for her to handle for the first few years of post wedding, managing family with a minimum financial resources was a challenging task.
    
    d. She shared so many instances of this not so good phase of life, but she made heart hard to handle them.
    
    e. There were section of people who didn't treat her well, which she carried that pain through out her life and it impacted her health.
    
    f. Transition from "Flying in air" before wedding to "Making heart hard" was a tough situation but god gave her the strength to go pass through it.

3. Family

    a. Immediate Family

        i. Happy Husband: 

One of the first trip of our family


            She was lucky to have a happy husband. They both coordinately took all the decisions in their life with minimum conflict of interests. My dad was busy at work at times and couldn't spend much time with us but she always understood him. They always celebrated the important events of life like Anniversaries / our birthdays by visiting temples / Restaurants. But they believed together that Son's education was their first priority of all.

            Few of the happiest moments in life:  
            a. My Dad being a Civil Engineer by himself, they were very determined to build their own Dream house.
            b. When we got first 4 Wheeler Maruti 800 car which is mostly first car of most of the Indians of their generation :) !!

During Construction of our First House


House Warming Ceremony

            She always prepared home cooked food, no matter what time my dad starts from home. My dad always fulfilled her wishes to visit many holy places like Kasi, Rameswaram, Puri, Tirupati... many other places and had good times over their 3 decades of togetherness.      



ii. Only Child: 

            She being one of the 8 siblings and my dad being one of the 8 siblings as well, my parents decided to have only One child, so that I don't have sibling competition...LOL !!

@ Kanyakumari, TamilNadu




            The only person anyone could ever ask you a question "You had your meal?" even before they ask "How are you?" is your mother. No matter what time of the day I call her, she asks the same first question.
            
@ Puri, Orissa
            
            She had been Diabetic since she was in early 30's and medicines at that time was not that great but she took care of her diet and controlled her self eating sweats / desserts. She managed well around 2 decades.

            Being the only child all my mom's attention was on me, I never wanted to leave my happy home and work at some other place, but there was a point where she asked if I would go to abroad for further studies and I accepted it before she could change her mind. 

            Most of the times my mom was very emotional and sensitive. But I also saw contrast shade of her, when ever situations were not going as expected, she never looked depressed, she always believed that things will get better and will be out the those bad phases soon. She has always been a great support to me.

Visited many places but found the best one.

    b. Sibling's Family members:

         She loves her brothers and elder sister a lot, she had great support from them through out her life. There were few instances where my dad got sick couple of times around 2 or 3 AM. First thing she did is to call her brothers, and they rushed to our home for help immediately to take to hospital. 

        
Mom with her siblings, nephew and nieces 
       
         I still remember her brothers having tea at my home and chat for long hours of time. I believe this is something rare these days as we all are busy with cell phones and life style.
        
        She had a very healthy relationship with her sibling's family members, all of them were very caring and took care of her a lot with their support. Some of my aunts and cousins never missed wishing on her birthday or anniversary. She was fortunate to have such a lovely family members.      
        
        These were just couple of the instances, and I may have to write a separate blog to tell about her relationship with her siblings and their families😊.

    

     c. Husband's Family members:

            My mom did her best to be the responsible eldest daughter in law. As my dad had 8 siblings, we have quite a big sweet cousins as well. 

            Being one of the youngest of all the siblings, she didn't had any younger sisters, but god had other plans for her. She had the best co-sisters (who are all younger to her) one can ever ask. They always have been very supportive and friendly with her in all aspects😊

My Dad's Brothers and family

4. Favorite Times

@Konark Temple

@Srisailam Temple


    a. Visiting Holy places - Most of the places we visited in our life were holy places. She never miss any opportunity to visit even a small temple.

    b. Playing chess / games - People say, you need to be smart to play chess 😎. She was very good at playing chess, I almost lost about 10's of games before I could win over her for the first time. She was my first and only chess guru. We also played many other games like Business (similar to Monopoly), Asta chamma..etc especially in the hot summer holidays to keep me engaged inside the home. 

    c. Cooking - I always enjoyed my mom's dishes, Aloo (Potato) and Bendi (Okra) fry are the best. Summer Mango pickles are the specials, her Daughter In-Law (my wife) still uses the same recipe for Mango pickle to prepare. Gulab jamun is the most made desert. 

    d. Talking to closed ones - Talking to people was one of her favorite things to do. She got along well with most of the people.

    e. Golden heart: Even though she didn't buy much gold as she expected, my Dad used to watch all kind of news in ETV channel for 1/2 hour, I was interested in sports update but my mom used to wait only for the gold rate for the day.

    f. Reading Rapidex to learn English (Telugu to English Translator) - She tried all her life to learn English but was partially successful with it.

    g. Watching Old movies - Akkineni Nageshwar Rao was her favorite actor and Kamal Hasan's "Akali Rajyam" (Hunger Country) was her all time favorite movie, and she never missed watching the movie on TV again and again. 

    h. Picture time: She just love being in pictures, we had a Negative Film Camera way long back in  1990's. It was not a common household thing at that time.


5. Perfect Wedding Date

Wedding time

    a. Sometimes I used to think my mom was too old fashioned, yes she is but her thinking was way ahead in some contexts, she regrets not being a working women, one of the advice she gave to my wife was to be a "Working Woman". 

    b. My mother was like every typical Indian mother who wants to choose a girl of her choice and I know she would get the best girl. So left her the choice 😄!!

    c. My parents got married on April 8th 1982, and we never knew that exactly after 30 years on the same day, I would be married on April 8th 2012 making it a Perfect Wedding Date. She had the best phase of her life and never saw her being so happy.

6. Final Destination

        She had a long due of going to one of most important trip of her life, Char Dham Yatra. She was just waiting for my wedding to finish and soon she left to visit these famous temples. After she returned from trip, Golden heart stopped beating, she passed away with heart attack and left vacuum (which can't be filled) in our lives on August 11th 2012 at the age of around 50

No matter how good or bad your childhood is, your parents tried their best to give you a better life. Take care of them when they need you. 

Hope you enjoyed knowing about my mother. Thanks for taking time to read it.



Tuesday, November 27, 2018

MVC basic details

http://www.binaryintellect.net/articles/4a00a9ce-73e5-4d89-aaae-2d835eca0854.aspx


Models:

 public class Customer
    {
        [EdmScalarPropertyAttribute(EntityKeyProperty = true, IsNullable = false)]
        public int CustomerID { get; set; }
        public string CustomerName { get; set; }
        public string CustomerContact { get; set; }
    }

 public class CustomersViewModel
    {
        public List Customers { get; set; }
        public Customer SelectedCustomer { get; set; }
        public string DisplayMode { get; set; }
    }

Controllers:

namespace DisplayAllInOnePage.Controllers
{
    public class CustomersController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();

        // GET: Customers
        public ActionResult Index()
        {
            //List customerList = new List();
            //Customer customer1 = new Customer();
            //customer1.CustomerID = 1;
            //customer1.CustomerName = "Name1";
            //customer1.CustomerContact = "Contact1";

            //Customer customer2 = new Customer();
            //customer2.CustomerID = 2;
            //customer2.CustomerName = "Name2";
            //customer2.CustomerContact = "Contact2";

            //var all = from c in db.Customers select c;
            //db.Customers.RemoveRange(all);
            //db.SaveChanges();

            //db.Customers.Add(customer1);
            //db.Customers.Add(customer2);
            //db.SaveChanges();

            CustomersViewModel model = new CustomersViewModel();
            model.Customers = db.Customers.OrderBy(m => m.CustomerID).Take(5).ToList();
            model.SelectedCustomer = null;
            return View(model);

            //return View(db.Customers.ToList());
        }
       
        [HttpPost]
        public ActionResult New()
        {           
            CustomersViewModel model = new CustomersViewModel();
            model.Customers = db.Customers.OrderBy(
                            m => m.CustomerID).Take(5).ToList();
            model.SelectedCustomer = null;
            model.DisplayMode = "WriteOnly";
            return View("Index", model);           
        }

        [HttpPost]
        public ActionResult Insert(Customer obj)
        {
            db.Customers.Add(obj);
            db.SaveChanges();

            CustomersViewModel model = new CustomersViewModel();
            model.Customers = db.Customers.OrderBy(
                                m => m.CustomerID).Take(5).ToList();
            model.SelectedCustomer = db.Customers.Find(obj.CustomerID);
            model.DisplayMode = "ReadOnly";
            return View("Index", model);           
        }

        [HttpPost]
        public ActionResult Select(int id)
        {
            CustomersViewModel model = new CustomersViewModel();
            model.Customers = db.Customers.OrderBy(
                        m => m.CustomerID).Take(5).ToList();
            model.SelectedCustomer = db.Customers.Find(id);
            model.DisplayMode = "ReadOnly";
            return View("Index", model);
        }

        [HttpPost]
        public ActionResult Edit(int id)
        {
            CustomersViewModel model = new CustomersViewModel();
            model.Customers = db.Customers.OrderBy(
                            m => m.CustomerID).Take(5).ToList();
            model.SelectedCustomer = db.Customers.Find(id);
            model.DisplayMode = "ReadWrite";
            return View("Index", model);           
        }

        [HttpPost]
        public ActionResult Update(Customer obj)
        {
            Customer existing = db.Customers.Find(obj.CustomerID);
            existing.CustomerName = obj.CustomerName;
            existing.CustomerContact = obj.CustomerContact;
            db.SaveChanges();

            CustomersViewModel model = new CustomersViewModel();
            model.Customers = db.Customers.OrderBy(
                            m => m.CustomerID).Take(5).ToList();

            model.SelectedCustomer = existing;
            model.DisplayMode = "ReadOnly";
            return View("Index", model);           
        }

        [HttpPost]
        public ActionResult Delete(int id)
        {           
            Customer existing = db.Customers.Find(id);
            db.Customers.Remove(existing);
            db.SaveChanges();

            CustomersViewModel model = new CustomersViewModel();
            model.Customers = db.Customers.OrderBy(
                                m => m.CustomerID).Take(5).ToList();

            model.SelectedCustomer = null;
            model.DisplayMode = "";
            return View("Index", model);           
        }

        [HttpPost]
        public ActionResult Cancel(int id)
        {
            CustomersViewModel model = new CustomersViewModel();
            model.Customers = db.Customers.OrderBy(
                                m => m.CustomerID).Take(5).ToList();
            model.SelectedCustomer = db.Customers.Find(id);
            model.DisplayMode = "ReadOnly";
            return View("Index", model);           
        }

        //// GET: Customers/Details/5
        //public ActionResult Details(int? id)
        //{
        //    if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    Customer customer = db.Customers.Find(id);
        //    if (customer == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(customer);
        //}

        //// GET: Customers/Create
        //public ActionResult Create()
        //{       
        //    return View();
        //}

        //// POST: Customers/Create
        //// To protect from overposting attacks, please enable the specific properties you want to bind to, for
        //// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Create([Bind(Include = "CustomerID,CustomerName,CustomerContact")] Customer customer)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.Customers.Add(customer);
        //        db.SaveChanges();
        //        return RedirectToAction("Index");
        //    }

        //    return View(customer);
        //}

        //// GET: Customers/Edit/5
        //public ActionResult Edit(int? id)
        //{
        //    if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    Customer customer = db.Customers.Find(id);
        //    if (customer == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(customer);
        //}

        //// POST: Customers/Edit/5
        //// To protect from overposting attacks, please enable the specific properties you want to bind to, for
        //// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Edit([Bind(Include = "CustomerID,CustomerName,CustomerContact")] Customer customer)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.Entry(customer).State = EntityState.Modified;
        //        db.SaveChanges();
        //        return RedirectToAction("Index");
        //    }
        //    return View(customer);
        //}

        //// GET: Customers/Delete/5
        //public ActionResult Delete(int? id)
        //{
        //    if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    Customer customer = db.Customers.Find(id);
        //    if (customer == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(customer);
        //}

        //// POST: Customers/Delete/5
        //[HttpPost, ActionName("Delete")]
        //[ValidateAntiForgeryToken]
        //public ActionResult DeleteConfirmed(int id)
        //{
        //    Customer customer = db.Customers.Find(id);
        //    db.Customers.Remove(customer);
        //    db.SaveChanges();
        //    return RedirectToAction("Index");
        //}

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}


Views:

Index.cshtml


@model DisplayAllInOnePage.Models.CustomersViewModel

@{
    Layout = null;
}





   
    Index
   

   

List of Customers



   

                       value="Insert" formaction="/Customers/new" />
       

       

           
                CustomerID
                CompanyName
                Actions
           
            @foreach (var item in Model.Customers)
            {
                if (Model.SelectedCustomer != null)
                {
                    if (item.CustomerID == Model.SelectedCustomer.CustomerID)
                    {
                        @:
                    }
                    else
                    {
                        @:
                    }
                }
                else
                {
                    @:
                }
                @item.CustomerID
                @item.CustomerName
               
                                               formaction="/Customers/select/@item.CustomerID"
                           value="Select" />
               
                   
                                                       formaction="/Customers/delete/@item.CustomerID"
                               value="Delete" />
                   
                    @:
            }
       
   
   

    @{
        if (Model.SelectedCustomer != null)
        {
            if (Model.DisplayMode == "ReadOnly")
            {
                Html.RenderPartial
                ("ShowCustomer", Model.SelectedCustomer);
            }
            if (Model.DisplayMode == "ReadWrite")
            {
                Html.RenderPartial
                ("EditCustomer", Model.SelectedCustomer);
            }
        }
        if (Model.DisplayMode == "WriteOnly")
        {
            Html.RenderPartial("InsertCustomer",
            new DisplayAllInOnePage.Models.Customer());
        }
    }
   






Create.cshtml

@model DisplayAllInOnePage.Models.Customer

@{
    ViewBag.Title = "Create";
}

Create




@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
   
   

       

Customer


       

        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
       

            @Html.LabelFor(model => model.CustomerName, htmlAttributes: new { @class = "control-label col-md-2" })
           

                @Html.EditorFor(model => model.CustomerName, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.CustomerName, "", new { @class = "text-danger" })
           
       

       

            @Html.LabelFor(model => model.CustomerContact, htmlAttributes: new { @class = "control-label col-md-2" })
           

                @Html.EditorFor(model => model.CustomerContact, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.CustomerContact, "", new { @class = "text-danger" })
           
       

       

           

               
           
       
   
}


    @Html.ActionLink("Back to List", "Index")


@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}


Delete.cshtml

@model DisplayAllInOnePage.Models.Customer

@{
    ViewBag.Title = "Delete";
}

Delete


Are you sure you want to delete this?

   

Customer

   
   
       
            @Html.DisplayNameFor(model => model.CustomerName)
       

       
            @Html.DisplayFor(model => model.CustomerName)
       

       
            @Html.DisplayNameFor(model => model.CustomerContact)
       

       
            @Html.DisplayFor(model => model.CustomerContact)
       

   

    @using (Html.BeginForm()) {
        @Html.AntiForgeryToken()

       
            |
            @Html.ActionLink("Back to List", "Index")
       
    }


Details.cshtml

@model DisplayAllInOnePage.Models.Customer

@{
    ViewBag.Title = "Details";
}

Details


   

Customer

   
   
       
            @Html.DisplayNameFor(model => model.CustomerName)
       

       
            @Html.DisplayFor(model => model.CustomerName)
       

       
            @Html.DisplayNameFor(model => model.CustomerContact)
       

       
            @Html.DisplayFor(model => model.CustomerContact)
       

   
    @Html.ActionLink("Edit", "Edit", new { id = Model.CustomerID }) |
    @Html.ActionLink("Back to List", "Index")


Edit.cshtml

@model DisplayAllInOnePage.Models.Customer

@{
    ViewBag.Title = "Edit";
}

Edit



@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    
   
       

Customer

       
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        @Html.HiddenFor(model => model.CustomerID)

       
            @Html.LabelFor(model => model.CustomerName, htmlAttributes: new { @class = "control-label col-md-2" })
           
                @Html.EditorFor(model => model.CustomerName, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.CustomerName, "", new { @class = "text-danger" })
           
       

       
            @Html.LabelFor(model => model.CustomerContact, htmlAttributes: new { @class = "control-label col-md-2" })
           
                @Html.EditorFor(model => model.CustomerContact, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.CustomerContact, "", new { @class = "text-danger" })
           
       

       
           
               
           
       
   
}

    @Html.ActionLink("Back to List", "Index")

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}


EditCustomer.cshtml

@model DisplayAllInOnePage.Models.Customer

@using (Html.BeginForm("Update", "Home", FormMethod.Post))
{
   
       
            Customer ID :
           
                @Html.TextBoxFor(m => m.CustomerID,
                         new { @readonly = "readonly" })
       
   
   
        Company Name :
        @Html.TextBoxFor(m => m.CustomerName)
   
   
        Contact Name :
        @Html.TextBoxFor(m => m.CustomerContact)
   
    
   
       
           
                   formaction="/Customers/update" />
           
                   formaction="/Customers/cancel/@Model.CustomerID" />
       
   
}



InsertCustomer.cshtml

@model DisplayAllInOnePage.Models.Customer

@using (Html.BeginForm("Insert", "Home", FormMethod.Post))
{
   
       
            Customer ID :
            @Html.TextBoxFor(m => m.CustomerID)
       
       
            Customer Name :
            @Html.TextBoxFor(m => m.CustomerName)
       
       
            Contact Name :
            @Html.TextBoxFor(m => m.CustomerContact)
       
        
       
           
               
                       formaction="/Customers/insert" />
               
                       formaction="/Customers/index" />
           
       
   
}

ShowCustomer.cshtml

@model DisplayAllInOnePage.Models.Customer

@using (Html.BeginForm("Edit", "Home", FormMethod.Post))
{
   
       
            Customer ID :
            @Model.CustomerID
       
       
            Customer Name :
            @Model.CustomerName
       
       
            Contact Name :
            @Model.CustomerContact
       
        
       
           
               
                       formaction="/Customers/edit/@Model.CustomerID" />
               
                       formaction="/Customers/index" />
           
       
   
}








Sunday, November 25, 2018

MVC Web API Sample

Referred Link with some changes.

https://www.c-sharpcorner.com/article/crud-Asp-Net-web-api-with-entity-framework-in-Asp-Net-mvc/

1. Create new Project and select Web API Project.
2. Create the EF ADO.NET Entity model
3. Build the project
4. Create Web API controllers for all tables.
5. Check if all APIs are working fine like below:
http://localhost:62279/api/Categories
http://localhost:62279/api/ListItems
6. Now add a new MVC project with name ending with Presentation to the solution.
7. Add Models for all the tables just copy from edmx file or use following template.
using System;
using System.ComponentModel.DataAnnotations;

namespace MVCPersatantion.Models
{
public class Customer
{
[Display(Name = "CustomerId")]
public int CustomerId { get; set; }
[Display(Name = "Name")]
public string Name { get; set; }
[Display(Name = "Address")]
public string Address { get; set; }
[Display(Name = "MobileNo")]
public string MobileNo { get; set; }
[Display(Name = "Birthdate")]
[DataType(DataType.Date)]
public DateTime Birthdate { get; set; }
[Display(Name = "EmailId")]
public string EmailId { get; set; }

}

}
8. Create ViewModel folder and add ViewModel files.
9. Add all ViewModel files like CategoryViewModel
10. Add the following code, add the missing dll if it is as follows.

Add a reference to System.Net.Http.Formatting.dll. This assembly is also available in the C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies folder.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web;

namespace MVCOutOfBasketClient.Models
{
    public class CategoryClient
    {
        private string Base_URL = "http://localhost:62279/api/";

        public IEnumerable findAll()
        {
            try
            {
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(Base_URL);
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage response = client.GetAsync("Categories").Result;

                if (response.IsSuccessStatusCode)
                    return response.Content.ReadAsAsync>().Result;
                return null;
            }
            catch
            {
                return null;
            }
        }
        public Category find(int id)
        {
            try
            {
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(Base_URL);
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage response = client.GetAsync("Categories/" + id).Result;

                if (response.IsSuccessStatusCode)
                    return response.Content.ReadAsAsync().Result;
                return null;
            }
            catch
            {
                return null;
            }
        }
        public bool Create(Category Category)
        {
            try
            {
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(Base_URL);
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage response = client.PostAsJsonAsync("Categories", Category).Result;
                return response.IsSuccessStatusCode;
            }
            catch
            {
                return false;
            }
        }
        public bool Edit(Category Category)
        {
            try
            {
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(Base_URL);
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage response = client.PutAsJsonAsync("Categories/" + Category.CustomerId, Category).Result;
                return response.IsSuccessStatusCode;
            }
            catch
            {
                return false;
            }
        }
        public bool Delete(int id)
        {
            try
            {
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(Base_URL);
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage response = client.DeleteAsync("Categories/" + id).Result;
                return response.IsSuccessStatusCode;
            }
            catch
            {
                return false;
            }
        }
    }
}


11. Add MVC Controllers

We have to add a controller, so for this right click on Controllers folder and add a controller and give the name for ex.Customer and write the code and call the service client method.



using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using MVCOutOfBasketClient.Models;

namespace MVCOutOfBasketClient.Controllers
{
    public class QuantityUnitsController : Controller
    {
        // GET: QuantityUnits
        public ActionResult Index()
        {
            QuantityUnitClient quantityUnitClient = new QuantityUnitClient();
            List listQuantityUnit = new List();
            listQuantityUnit = (List) quantityUnitClient.findAll();
         
            return View(listQuantityUnit);
        }

        // GET: QuantityUnits/Details/5
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            QuantityUnitClient quantityUnitClient = new QuantityUnitClient();
            QuantityUnit quantityUnit = new QuantityUnit();
            quantityUnit = (QuantityUnit)quantityUnitClient.find((int)id);

            if (quantityUnit == null)
            {
                return HttpNotFound();
            }
            return View(quantityUnit);
        }

        // GET: QuantityUnits/Create
        public ActionResult Create()
        {
            return View();
        }

        // POST: QuantityUnits/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "QuantityUnitId,QuantityUnitName,QuantityUnitDescription")] QuantityUnit quantityUnit)
        {
            if (ModelState.IsValid)
            {
                QuantityUnitClient quantityUnitClient = new QuantityUnitClient();
                quantityUnitClient.Create(quantityUnit);
                return RedirectToAction("Index");
            }

            return View(quantityUnit);
        }

        // GET: QuantityUnits/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            QuantityUnitClient quantityUnitClient = new QuantityUnitClient();
            QuantityUnit quantityUnit = quantityUnitClient.find((int)id);

            if (quantityUnit == null)
            {
                return HttpNotFound();
            }
            return View(quantityUnit);
        }

        // POST: QuantityUnits/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "QuantityUnitId,QuantityUnitName,QuantityUnitDescription")] QuantityUnit quantityUnit)
        {
            if (ModelState.IsValid)
            {
                QuantityUnitClient quantityUnitClient = new QuantityUnitClient();
                quantityUnitClient.Edit(quantityUnit);             

                return RedirectToAction("Index");
            }
            return View(quantityUnit);
        }

        // GET: QuantityUnits/Delete/5
        public ActionResult Delete(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            QuantityUnitClient quantityUnitClient = new QuantityUnitClient();
            QuantityUnit quantityUnit = quantityUnitClient.find((int)id);

            if (quantityUnit == null)
            {
                return HttpNotFound();
            }
            return View(quantityUnit);
        }

        // POST: QuantityUnits/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            QuantityUnitClient quantityUnitClient = new QuantityUnitClient();
            QuantityUnit quantityUnit = null;
            quantityUnit = quantityUnitClient.find((int)id);
            if (quantityUnit != null)
            {
                quantityUnitClient.Delete((int)id);
            }
            else
            {
                return HttpNotFound();
            }
            return RedirectToAction("Index");
        }
    }
}

Tuesday, June 12, 2018

Baraha - Telugu Font - BRH Telugu - ANSI to UNICODE Conversion

Recently I worked on converting a Legacy VB.NET Windows application to C# based Web application. One of our client used a Baraha software in the windows application and Telugu data is saved in ANSI Format and its not readable from SQL Server Database. It looks something like "ȢÀÀlµdº ¶ÂªA¶¢hµù±ÂµA" for "à°®ొదటి à°¸ంవత్సరం". I really had hard time converting the ANSI format to Unicode using Baraha. I couldn't find any solution online and reached out to Baraha Support but still couldn't find a solution. Finding out the 6th step in the steps below was crucial. So thought of sharing the information in my blog so that it will be useful to some other developers.
You can find more information on their website http://www.baraha.com/
Below are the steps to convert them.

1. Open the Baraha 8.0 version, Goto Settings --> Other.
2. Change the Editor Font to "BRH Telugu". Click Ok.
3. Copy the ANSI text as below.
ȢÀÀlµdº ¶ÂªA¶¢hµù±ÂµA
4. Paste in the text editor in Baraha 8.0.
5. Confirm that text is readable in Telugu.
6. Copy the text FROM THE EDITOR ONLY (Place where you copied to) and paste in Baraha new version Baraha 10.10.168. Need IME Version of it.
7. Translate using the button to display in upper/top section.
8. Right click and copy using "Unicode" selection and Paste in Excel or Text file as "à°®ొదటి à°¸ంవత్సరం".

Wednesday, April 21, 2010

My names and their history

I want to share something interesting how and what people called me with different names. I would like to share various names i was referred by and their history(Not huge lessons of Social History..Lol).

Starting with my original name VIDYANAND, this name was given by my parents (if i'm not wrong its my dad). My name is a combination of two words (Vidya[studying] + Anand[Happy/Enjoy]) which means a person who enjoys studying. Yes i do enjoy studying. But i was never the topper of the class but consistent and good enough to survive. Even parents wouldn't expect me to be the topper in the class but would be happy if i'm in the list of top 10-15 in the class :)..Hope i didn't disappointed them too often !!

My second name by which most of relatives refer me is TINKU. It literally has no meaning, but i know how i got this name. When i was born, there was an advertisement on TV where a cute n chubby boy used to appear in that ad. His mom called him tinku in the ad, that little cute boy was looking similar to me (this is something you guys need to believe me..i was cute..lol) it seems. Hence the name Tinku[:d]!!!

Both names mentioned above were named before my remembrance. Those names were given when i was less than 1 year old. All that stuff is what i heard from others(my parents and relatives) and not what i have gone through.

My next name was KIFFU (hahahaha, even this has no meaning)...probably not many people know about this. Only couple of my cousins used to call me for a while. I had a very good Red-Colored T-shirt which says KIFFU on it. Thats why they used to call me so. I was about 5-7 years old then !!

When i was about 13-14 years old (8th or 9th standard), a new hero was introduced to TOLLYWOOD (Telugu Indian movies) named Vadde Naveen. My friends (Chandu and Srikanth) started referring me as VIDDE from that time. This is one name by which most of my friends refers me. As usual no meaning to this name too[:P]. People who are lazy to call my BIG name VIDYANAND started calling VIDDE from then.

My friends and colleagues in US had a challenging task of pronouncing my complete name. I don't mind if they misspell my name. But they don't want to do so. So my boss at work took the first 3 letters of my name and made it as VID. This is the shortest name of all my names. Hope it don't get short any more[:P] !!

My friend reminded me few other names in my schooldays which didn't last long though, they are 420 and Dabarlal Chyawanprash [:d] !!!

I wanna add the name VIDYA (first part of my first name) to the list of names. Some of my friends refer me with this name too !!

Another name referred by one of my First American friend was Mr.V !!

FINAL NOTE : I don't have any preference to my names because I go by people's choice[:)]...VIDYANAND, TINKU, VIDDE,VIDYA,VID, Mr.V ....names goes on!!!

Sunday, February 7, 2010

Best Quotes i collected

Quotes collection is one of my favorite hobbies(I've very few hobbies though[:d]).The one which i wrote my self (not a great one though)is

71. No destination is far untill you find a way to reach it ...Vid !!!


Some of the best quotes of my collection are:

1. Failure means delay but not defeat. (The first and my most inspiring quote of my life.)

2. Be the reason for someone's Happiness, never a part of it.Be a part of someone's sadness, never the reason for it!!!!

3. Stop searching forever, happiness is just next to you

4. "Making a Million Frns Is Not A Miracle, The Miracle Is To Have A Friend Who Will Be In Ur Favour When Millions Are Against You

5. The most beautiful thing is to see a person smiling…
And even more beautiful is knowing that you are the reason behind it!!!
Be a reason for others to smile :-)

6. There is one perfect child in the world that every mother has, there is one perfect wife in the world that neighbour has.

7. Great people discuss ideas, average discuss events, poor people discuss about people.

8. Stop searching forever, happiness is just next to you

9. Some people dream of success....while some others wake up and work hard at it.

10. Sometimes in life, you find a special friend... Someone who changes your life just by being part of it... Someone who makes you laugh until you can't stop...Someone who makes you believe that there really is good in the world. Someone who convinces you that there really is an unlocked door just waiting for you to open it……

11. Friends are those think and care about you...when you are away from them !!!!

12. If you start judging people you will be having no time to love them.......Mother Teresa.

13. Never break four things in your life - Trust, Promise, Relation & Heart because when they break they don't make noise but pains a lot !!!........Charles.

14. Almost every mistake is a gift IF you learn from it.

15. Never argue with a fool, people might not know the difference.

16. Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity. - Albert Einstein

17. Arrow goes forward only after pulling in to backward. Bullet goes forward only after pressing the trigger backward.

Every human being will get happy only after facing the difficulties in their life path....

So do not afraid to face your difficulties. They will push you forward.


18. It's true that we don't know what we've got until we lose it, but it's also true that we don't know what we've been missing until it arrives.

19. "Falling down is not defeat...defeat is when you refuse to get up..."

20. Love is the other name for continuation of species[:d] !!!!!

21. If you would stand well with a great mind, leave him with a favorable impression of yourself; if with a little mind, leave him with a favor

22. I have learned that the greater part of our misery or unhappiness is determined not by our circumstance but by our disposition.

23. Fate, is an excuse for why we end up where we do! Our 'Actions' predetermine our Destiny, our 'Reactions' seal that fate!

24. We must all suffer from one of two pains: the pain of discipline or the pain of regret. The difference is discipline weighs ounces while regret weighs tons.

25. Your schooling may be over, but remember that your education still continues.

26. All that stands between the graduate and the top of the ladder is the ladder.

27. A good cigar is as great a comfort to a man as a good cry is to a woman.

28. We do not quit playing because we grow old, we grow old because we quit playing.

29. The road to a friend's house is never long

30. Be slow in choosing a friend, but slower in changing him.

31. Your capacity to keep your vow will depend on the purity of your life....Gandhi

32. Fear is pain arising from the anticipation of evil.

33. In this life we cannot do great things. We can only do small things with great love

34. Loneliness and the feeling of being unwanted is the most terrible poverty.

35. The biggest disease today is not leprosy or tuberculosis, but rather the feeling of being unwanted.

36. Life is like a piano, White keys R happy moments and Black keys are sad moments. But remember both keys are played together to give Sweet music in life...

37. I am not here to spoil your past but to make your future.....

38. The first step to get the things you want out of life is this: Decide what you want

39. The great successful men of the world have used their imaginations. They think ahead and create their mental picture, and then go to work materializing that picture in all its details, filling in here, adding a little there, altering this bit and that bit, but steadily building, steadily building. -- Robert Collier

40. Nothing can have value with out being an object of utility

41. Past is Experience. Present is Experiments. Future is Expectations. Use your Experience in your Experiments to achieve your Expectations

42. Always bear in mind that your own resolution to succeed is more important than any other one thing.

43. Communication does not always travel on the wheels of the written or the spoken word,Silence too speaks

44. Laugh so hard that even sorrow smiles at you
Live life so well that even death loves to see you live
Fight so hard that even fate accepts its defeat.......

45. Always bear in mind that your own resolution to succeed is more important than any other one thing.

46. Happiness keeps You Sweet, Trials keep You Strong, Sorrows keep You Human, Failures keep You Humble,Success keeps You Glowing, But Only God keeps You Going!

47. Avoid Rape...Say Yes!!!I know tht U believe you understand wht u think I said, but I'm nt sure u realize tht what u heard is nt wht I meant!

48. Pleasure/Fear is the reason behind any human action.

49. Smile is a language of love, a source to win hearts... So keep smiling

50. In life, dont expect anything from anyone.Because expectation, when not fulfilled, gives you pain.When you get something without expecting it,It gives you pleasure.Keep doing your part and leave the rest to god

51. bad frnds hit you on the back.. gud frnds hit u on the face... so how many hit u 2day !!!

52. The trouble with most people is that they think with their hopes or fears or wishes rather than with their minds.

53. Conclusion is the place where u got tired of thinking!!

54. Happiness is inversely proportional to expectations.

55. Time itself is an individual gift. It is wise to cherish it carefully and give it away generously.

56. In three words I can sum up everything I've learned about life: It goes on. -- Robert Frost

57. Common sense and a sense of humor are the same thing, moving at different speeds. A sense of humor is just common sense, dancing.

58. Life is a GAME....u vil find Defenders Overcome them tre I could see the light! :P

59. God made us to share and have differences. "Men think that the faster way to go to a point is to go straight, and Women know that the faster way to go to a point is to go to the curves." -Miss Thailand,08

60. True friends are like diamonds, precious and rare. False friends are like leaves, found everywhere.

61. The ones that you love the most are usually the ones that hurt you the most wooooooooooh

62. No Great thing is Impossible the word itself says I'm Possible

63. Life is too short to waste time hating anyone.

64. If you can't fly then run...If you can't run then walk...If you can't walk then crawl...remember: keep moving!!

65. Success is not final, failure is not fatal: it is the courage to continue that counts

66. Don't walk as if u r the king of the world, but walk as it don't matter to u who's the king of the world

67. If u want something you never had,do something you have never done.

68. Sometimes the lies you tell are less frightening than the loneliness you might feel if you stopped telling them.

69. Do not fear going forward slowly; fear only to stand still.

70. For every minute you are angry with someone, you loose 60 seconds of happiness that you can never get back!!!

71. No destination is far untill you find a way to reach it ...Vid !!!

72. Success usually comes to those who are too busy to be looking for it

73. If it happens once, it's a bug. If it happens twice, it's a feature. If it happens more than twice, it's a design philosophy.

74. If you obey all the rules, you miss all the fun.

75. suggest, ask, request, demand, forget......thats life !!!!!

76. Many of the great achievements of the world were accomplished by tired and discouraged men who kept on working

77. Watch what you say - of those who say nothing, few are silent

78. There are three kinds of lies: lies, damn lies, and statistics

79. A person needs a clean reputation to survive

80. Success kisses you in private but failure fucks you in public.

81. If two wrongs make a right, which one is right.

82. Attitude is what life is all about...Soldier: Sir we are surrounded from all sides by enemies, Major: Excellent! we can attack in any direction!

83. Success is not final, failure is not fatal: it is the courage to continue that counts

84. Well-timed silence has more eloquence than speech.

85. Success is the ability to go from one failure to another with no loss of enthusiasm

86. One day your life will flash before your eyes. Make sure its worth watching.

87. Money is a silent boss that dictates u to do thngs with no words spoken!!!

88. Silence speaks a lot, infact more than words....only thing is, it is difficult to comprehend wat silence speaks!!!

89. Life is short--let's be crazy...Jessica Wolbert!!!

90. Killing a man's thought is more important than killing him !!