public static string PMSaveWLocation(object WLocationInfo, string LocationID) { string result = ""; CustomProfile profile = CustomProfile.GetProfile(); iWarehouseClient Warehouseclient = new iWarehouseClient(); mLocation loc = new mLocation(); tSKUTransaction skutrans = new tSKUTransaction(); try { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary = (Dictionary <string, object>)WLocationInfo; loc.ShelfID = long.Parse(dictionary["ShelfID"].ToString()); loc.Code = dictionary["LocationCode"].ToString(); loc.AliasCode = dictionary["AliasCode"].ToString(); loc.SortCode = long.Parse(dictionary["SortCode"].ToString()); loc.LocationType = dictionary["LocationType"].ToString(); loc.CapacityIn = long.Parse(dictionary["CapacityIn"].ToString()); loc.Capacity = decimal.Parse(dictionary["Capacity"].ToString()); loc.VelocityType = dictionary["VelocityType"].ToString(); loc.CompanyID = long.Parse(dictionary["CompanyID"].ToString()); loc.CustomerID = long.Parse(dictionary["CustomerID"].ToString()); loc.Active = dictionary["Active"].ToString().Trim(); loc.WarehouseID = long.Parse(dictionary["WarehouseID"].ToString()); skutrans.ClosingBalance = 0; skutrans.InQty = 0; skutrans.OutQty = 0; skutrans.CreatedBy = profile.Personal.UserID; skutrans.CreationDate = DateTime.Now; skutrans.CompanyID = long.Parse(dictionary["CompanyID"].ToString()); skutrans.CustomerID = long.Parse(dictionary["CustomerID"].ToString()); if (LocationID != "0") { loc.ID = long.Parse(LocationID); loc.CreatedBy = profile.Personal.UserID; loc.CreationDate = DateTime.Now; long LocID = Warehouseclient.SaveWarehouseLocation(loc, profile.DBConnection._constr); } else { loc.AvailableBalance = 0; loc.CreatedBy = profile.Personal.UserID; loc.CreationDate = DateTime.Now; long LocID = Warehouseclient.SaveWarehouseLocation(loc, profile.DBConnection._constr); skutrans.LocationID = LocID; Warehouseclient.AddRecordInSkuTransaction(skutrans, profile.DBConnection._constr); } result = "Location saved successfully"; } catch { result = "Some error occurred"; } finally { Warehouseclient.Close(); } return(result); }