public async Task <BranchCreateModel> CreateBranch(BranchCreateModel data) { try { BranchCreateModel model = null; tblBranch dataBranch = await Task.Run(() => ManageBranch.InsertBranch(data.ConvertTotblBranch())); model = (await Task.Run(() => ManageBranch.GetBranchDetails(dataBranch.ID))).ConvertToBranch(); data.branchId = model.id; switch (data.companyType) { case "MSP": tblMSPLocationBranch dataMSP = await Task.Run(() => ManageMSP.InsertMSPLocationBranch(data.ConvertTotblMSPLocationBranch())); break; case "Customer": tblCustomerLocationBranch dataCustomer = await Task.Run(() => ManageCustomer.InsertCustomerLocationBranch(data.ConvertTotblCustomerLocationBranch())); break; case "Supplier": tblSupplierLocationBranch dataSupplier = await Task.Run(() => ManageSupplier.InsertSupplierLocationBranch(data.ConvertTotblSupplierLocationBranch())); break; } return(model); } catch (Exception ex) { throw; } }
public async Task DeleteBranch(BranchCreateModel data) { try { switch (data.companyType) { case "MSP": await Task.Run(() => ManageMSP.DeleteMSPLocationBranch(data.id, "Branch")); break; case "Customer": await Task.Run(() => ManageCustomer.DeleteCustomerLocationBranch(data.id, "Branch")); break; case "Supplier": await Task.Run(() => ManageSupplier.DeleteSupplierBranchLocation(data.id, "Branch")); break; } await Task.Run(() => ManageBranch.DeleteBranch(data.id)); } catch (Exception) { throw; } }
public async Task <LocationCreateModel> CreateLocation(LocationCreateModel data) { try { LocationCreateModel model = null; tblLocation dataLocation = await Task.Run(() => ManageLocation.InsertLocation(data.ConvertTotblLocation())); model = (await Task.Run(() => ManageLocation.GetLocationDetails(dataLocation.ID))).ConvertToLocation(); data.locationId = model.id; switch (data.companyType) { case "MSP": tblMSPLocationBranch dataMSP = await Task.Run(() => ManageMSP.InsertMSPLocationBranch(data.ConvertTotblMSPLocationBranch())); break; case "Customer": tblCustomerLocationBranch dataCustomer = await Task.Run(() => ManageCustomer.InsertCustomerLocationBranch(data.ConvertTotblCustomerLocationBranch())); break; case "Supplier": tblSupplierLocationBranch dataSupplier = await Task.Run(() => ManageSupplier.InsertSupplierLocationBranch(data.ConvertTotblSupplierLocationBranch())); break; } return(model); } catch (Exception) { throw; } }
private void onClickSubManageSupplier(object sender, RoutedEventArgs e) { if (RibbonContainer.SelectedItem is RibbonTab) { RibbonTab selectedTab = (RibbonTab)RibbonContainer.SelectedItem; selectedTab.Items.Clear(); selectedTab.Header = "Supplier"; selectedTab.Margin = new Thickness(0, 0, -200, -727); RibbonGroup ManageSupplierTabGroup = new RibbonGroup(); ManageSupplierTabGroup.Background = (Brush)FindResource("Purchase"); ContextMenu contextMenu = new ContextMenu(); MenuItem closeMenuItem = new MenuItem(); closeMenuItem.Header = "Close"; closeMenuItem.Click += MenuItem_Click_1; contextMenu.Items.Add(closeMenuItem); ManageSupplierTabGroup.ContextMenu = contextMenu; UserControl ManageSupplierTabContent = new ManageSupplier(); ManageSupplierTabGroup.Items.Add(ManageSupplierTabContent); selectedTab.Items.Add(ManageSupplierTabGroup); } }
public void GetSupplier() { con = new DBConnection(); var supps = new List <ManageSupplier>(); con.OpenConection(); con._dr = con.DataReader(@"SELECT * FROM suppliers ORDER BY suppname ASC"); while (con._dr.Read()) { var sup = new ManageSupplier { suppId = Convert.ToInt32(con._dr["suppid"].ToString()), suppCode = con._dr["suppcode"].ToString(), suppName = con._dr["suppname"].ToString(), suppAdd = con._dr["suppadd"].ToString(), suppContact = con._dr["suppcontact"].ToString() }; supps.Add(sup); } con._dr.Close(); con.CloseConnection(); var js = new JavaScriptSerializer(); Context.Response.Write(js.Serialize(supps)); }
public void GetSupplierById(int id) { con = new DBConnection(); ManageSupplier suppl = new ManageSupplier(); con.OpenConection(); con._dr = con.DataReader(@"SELECT * FROM suppliers WHERE suppid='" + id + "'"); while (con._dr.Read()) { suppl.suppId = Convert.ToInt32(con._dr["suppid"].ToString()); suppl.suppName = con._dr["suppname"].ToString(); suppl.suppAdd = con._dr["suppadd"].ToString(); suppl.suppCode = con._dr["suppcode"].ToString(); suppl.suppContact = con._dr["suppcontact"].ToString(); } con._dr.Close(); con.CloseConnection(); JavaScriptSerializer js = new JavaScriptSerializer(); Context.Response.Write(js.Serialize(suppl)); }
public async Task <List <BranchCreateModel> > GetBranchs(LocationBranchModel data) { try { List <BranchCreateModel> model = null; List <tblBranch> resModel = null; long Id = data != null?Convert.ToInt64(data.companyId) : 0; switch (data.companyType) { case "MSP": long id = Convert.ToInt64(ConfigurationManager.AppSettings["MSP_ID"]); Id = id != null ? id : Id; resModel = await Task.Run(() => ManageMSP.GetMSPBranches(Id, data.locationId)); break; case "Customer": resModel = await Task.Run(() => ManageCustomer.GetCustomerBranches(Id, data.locationId)); break; case "Supplier": resModel = await Task.Run(() => ManageSupplier.GetSupplierBranches(Id, data.locationId)); break; } model = resModel.Select(a => a.ConvertToBranch()).ToList(); return(model); } catch (Exception) { throw; } }
public async Task <List <LocationCreateModel> > GetLocations(LocationCreateModel data) { try { List <LocationCreateModel> res = null; List <tblLocation> resData = null; long Id = data != null?Convert.ToInt64(data.companyId) : 0; switch (data.companyType) { case "MSP": long id = Convert.ToInt64(ConfigurationManager.AppSettings["MSP_ID"]); Id = id != null ? id : Id; resData = await Task.Run(() => ManageMSP.GetMSPLocation(Id)); break; case "Customer": resData = await Task.Run(() => ManageCustomer.GetCustomerLocation(Id)); break; case "Supplier": resData = await Task.Run(() => ManageSupplier.GetSupplierLocation(Id)); break; } res = resData.Select(a => a.ConvertToLocation()).ToList(); return(res); } catch (Exception) { throw; } }