public JsonResult GetCustomerData(int id) { CustM objCust = new CustM(); var cust = (from c in db.CustomerMasters where c.CustomerID == id select c).FirstOrDefault(); objCust.CustID = cust.CustomerID; objCust.CustName = cust.CustomerName; objCust.ContactPerson = cust.ContactPerson; objCust.Address1 = cust.Address1; objCust.Address2 = cust.Address2; objCust.Address3 = cust.Address3; objCust.Phone = cust.Phone; //objCust.CountryID = cust.CountryID; //.Value; //objCust.CityID = cust.CityID;//.Value; // objCust.CustCode = cust.CustomerCode; //objCust.LocationID = cust.LocationID;//.Value; return(Json(objCust, JsonRequestBehavior.AllowGet)); }
public JsonResult GetConsigneeData(string consigneename) { CustM objCust = new CustM(); var cust = (from c in db.CustomerMasters where c.CustomerName == consigneename && c.CustomerType == "CN" select c).FirstOrDefault(); if (cust != null) { objCust.CustID = cust.CustomerID; objCust.CustCode = cust.CustomerCode; objCust.CustName = cust.CustomerName; objCust.ContactPerson = cust.ContactPerson; objCust.Address1 = cust.Address1; objCust.Address2 = cust.Address2; objCust.Address3 = cust.Address3; objCust.Phone = cust.Phone; objCust.CountryName = cust.CountryName; objCust.CityName = cust.CityName; objCust.LocationName = cust.LocationName; } return(Json(objCust, JsonRequestBehavior.AllowGet)); }
public JsonResult GetCustomerData(int id) { CustM objCust = new CustM(); var cust = (from c in db.CustomerMasters where c.CustomerID == id select c).FirstOrDefault(); objCust.CustID = cust.CustomerID; objCust.CustName = cust.CustomerName; objCust.ContactPerson = cust.ContactPerson; objCust.Address1 = cust.Address1; objCust.Address2 = cust.Address2; objCust.Address3 = cust.Address3; objCust.Phone = cust.Phone; objCust.CountryName = cust.CountryName; objCust.CityName = cust.CityName; objCust.LocationName = cust.LocationName; objCust.OfficeOpenTime = cust.OfficeOpenTime.ToString(); objCust.OfficeCloseTime = cust.OfficeCloseTime.ToString(); return(Json(objCust, JsonRequestBehavior.AllowGet)); }
public string SaveConsignee(PickupRequestVM v) { CustM objCust = new CustM(); var cust = (from c in db.CustomerMasters where c.CustomerName == v.Consignee && c.CustomerType == "CN" select c).FirstOrDefault(); int accompanyid = Convert.ToInt32(Session["CurrentCompanyID"].ToString()); int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString()); if (cust == null) { CustomerMaster obj = new CustomerMaster(); int max = (from d in db.CustomerMasters orderby d.CustomerID descending select d.CustomerID).FirstOrDefault(); obj.CustomerID = max + 1; obj.AcCompanyID = accompanyid; obj.CustomerCode = ""; // _dao.GetMaxCustomerCode(branchid); // c.CustomerCode; obj.CustomerName = v.Consignee; obj.CustomerType = "CN"; //Consignee obj.ContactPerson = v.ConsigneeContact; obj.Address1 = v.ConsigneeAddress; obj.Address2 = v.ConsigneeAddress1; obj.Address3 = v.ConsigneeAddress2; obj.Phone = v.ConsigneePhone; obj.CountryName = v.ConsigneeCountryName; obj.CityName = v.ConsigneeCityName; obj.LocationName = v.ConsigneeLocationName; db.CustomerMasters.Add(obj); db.SaveChanges(); } return("ok"); }