public void AcceptBRefund(object CounterID, object BRefundID, object UserID, DataTable dtBRefundDetail) { try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_U_BREFUND]"; cmd.Parameters.AddWithValue("@dtbrd", dtBRefundDetail); cmd.Parameters.AddWithValue("@COUNTERID", CounterID); cmd.Parameters.AddWithValue("@BREFUNDID", BRefundID); cmd.Parameters.AddWithValue("@USERID", UserID); cmd.ExecuteNonQuery(); } } catch (Exception ex) { throw new Exception("Error While Accepting Branch Refund", ex); } finally { SQLCon.Sqlconn().Close(); } }
public DataTable GetDCList() { DataTable dt = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_DISPATCHDCLIST]"; using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); } } } catch (Exception ex) { throw new Exception("Error While Retreiving Dispatch DC List", ex); } finally { SQLCon.Sqlconn().Close(); } return(dt); }
public void DiscardStockEntry(object StockEntryID) { try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_D_DISCARDSTOCKENTRY]"; cmd.Parameters.AddWithValue("@STOCKENTRYID", StockEntryID); int RowsAffected = cmd.ExecuteNonQuery(); if (RowsAffected <= 0) { throw new Exception("Nothing is deleted"); } } } catch (Exception ex) { throw new Exception("Error While Deleting Invoice"); } finally { SQLCon.Sqlconn().Close(); } }
public DataSet GetInvoice(object StockEntryID) { DataSet ds = new DataSet(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_STOCKENTRY]"; cmd.Parameters.AddWithValue("@STOCKENTRYID", StockEntryID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } } } catch (Exception ex) { throw new Exception("Error While Retreiving Invoice"); } finally { SQLCon.Sqlconn().Close(); } return(ds); }
public DataSet SaveDispatchDC(object BranchID, object CategoryID, object UserID) { DataSet ds = new DataSet(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_CU_DISPATCHDC]"; cmd.Parameters.AddWithValue("@CATEGORYID", CategoryID); cmd.Parameters.AddWithValue("@BRANCHID", BranchID); cmd.Parameters.AddWithValue("@USERID", UserID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } } } catch (Exception ex) { throw new Exception("Error While Saving Dispatch DC", ex); } finally { SQLCon.Sqlconn().Close(); } return(ds); }
/// <summary> /// Code to get LV rasters related to project /// </summary> /// <returns></returns> public DataTable Get_LVRaster() { DataTable dtRaster = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[P_Get_LVRaster]"; using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dtRaster); } } } catch (Exception ex) { if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE") { throw new Exception("Fehler beim Laden der Rasters"); } else { throw new Exception("Error Occured While Retreiving Rasters"); } } finally { SQLCon.Close(); } return(dtRaster); }
/// <summary> /// Code to get old raster if old raster if raster got changed /// </summary> /// <param name="_ProjectID"></param> /// <returns></returns> public string GetOld_LVRaster(int _ProjectID) { string Old_Raster = string.Empty; try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[P_Get_Old_LVRaster]"; cmd.Parameters.AddWithValue("@ProjectID", _ProjectID); object _objreturn = cmd.ExecuteScalar(); Old_Raster = Convert.ToString(_objreturn); } } catch (Exception ex) { if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE") { throw new Exception("Fehler beim Laden der Rasters"); } else { throw new Exception("Error Occured While Retreiving Rasters"); } } finally { SQLCon.Close(); } return(Old_Raster); }
public SubCategory DeleteSubCategory(SubCategory ObjSubCategory) { int SubCategoryID = 0; try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_D_SUBCATEGORY]"; cmd.Parameters.AddWithValue("@SUBCATEGORYID", ObjSubCategory.SUBCATEGORYID); cmd.Parameters.AddWithValue("@USERID", ObjSubCategory.UserID); object objReturn = cmd.ExecuteScalar(); string str = Convert.ToString(objReturn); if (!int.TryParse(str, out SubCategoryID)) { throw new Exception(str); } else { ObjSubCategory.SUBCATEGORYID = objReturn; } } } catch (Exception ex) { throw new Exception("Error While Deleteing Sub Category"); } finally { SQLCon.Sqlconn().Close(); } return(ObjSubCategory); }
public DataTable ChangePassword(User ObjUser) { DataTable dtUser = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_U_PASSWORD]"; cmd.Parameters.AddWithValue("@USERID", ObjUser.USERID); cmd.Parameters.AddWithValue("@PASSWORDSTRING", ObjUser.PASSWORDSTRING); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dtUser); } if (dtUser != null && dtUser.Rows.Count > 0) { int Ivalue = 0; string str = Convert.ToString(dtUser.Rows[0][0]); if (!int.TryParse(str, out Ivalue)) { throw new Exception(str); } } } } catch (Exception ex) { throw ex; } finally { SQLCon.Sqlconn().Close(); } return(dtUser); }
public DataTable GetSyncStatus() { DataTable dtSyncStatus = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.SqlCloudConn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_SHOWSYNC]"; using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dtSyncStatus); } } } catch (Exception ex) { throw new Exception("Error While sync status from cloud database", ex); } finally { SQLCon.SqlCloudConn().Close(); } return(dtSyncStatus); }
public DataTable GetPrinterSettings(object UserID) { DataTable dtPrinterSettings = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_PRINTERSETTINGS]"; cmd.Parameters.AddWithValue("@USERID", UserID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dtPrinterSettings); } } } catch (Exception ex) { throw new Exception("Error While Retrieving Printer Settings"); } finally { SQLCon.Sqlconn().Close(); } return(dtPrinterSettings); }
/// <summary> /// Code to save Auto save checkbox status in database /// </summary> /// <param name="ObjEUserInfo"></param> /// <returns></returns> public EUserInfo UpdateAutoSave(EUserInfo ObjEUserInfo) { DataSet dsFeature = new DataSet(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[P_Upd_AutoSave]"; cmd.Parameters.AddWithValue("@UserID", ObjEUserInfo.UserID); cmd.Parameters.AddWithValue("@AutoSave", ObjEUserInfo.AutoSaveMode); object Objreturn = cmd.ExecuteScalar(); string str = Convert.ToString(Objreturn); if (!string.IsNullOrEmpty(str)) { throw new Exception(str); } } } catch (Exception ex) { throw new Exception("Error While updating AutoSave Mode"); } return(ObjEUserInfo); }
public DataTable GetDayClosure(object BranchID) { DataTable dtDayClosure = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_DAYCLOSURE]"; cmd.Parameters.AddWithValue("@BRANCHID", BranchID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dtDayClosure); } } } catch (Exception ex) { throw new Exception("Error While Retrieving Day Closure List", ex); } finally { SQLCon.Sqlconn().Close(); } return(dtDayClosure); }
public DataTable GetBRefundDetail(object BRefundID, object CounterID) { DataTable dtBRefundDetail = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_BREFUNDDETAIL]"; cmd.Parameters.AddWithValue("@BREFUNDID", BRefundID); cmd.Parameters.AddWithValue("@COUNTERID", CounterID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dtBRefundDetail); } } } catch (Exception ex) { throw new Exception("Error While Retrieving Branch Refund Details", ex); } finally { SQLCon.Sqlconn().Close(); } return(dtBRefundDetail); }
/// <summary> /// Code to update factors from Multi5 module /// </summary> /// <param name="ObjEMulti"></param> /// <returns></returns> public EMulti UpdateMulti5(EMulti ObjEMulti) { try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[P_Upd_Multi]"; cmd.Parameters.Add("@ProjectID", ObjEMulti.ProjectID); cmd.Parameters.Add("@LVSection", ObjEMulti.LVSection); cmd.Parameters.Add("@dt", ObjEMulti.dtArticles); cmd.ExecuteNonQuery(); } } catch (Exception ex) { if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE") { throw new Exception("Fehler beim Aktualisierung von Multi 5"); } else { throw new Exception("Error while updating multi5"); } } finally { SQLCon.Close(); } return(ObjEMulti); }
public Counter DeleteCounter(Counter ObjCounter) { int CounterID = 0; try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_D_BRANCHCOUNTER]"; cmd.Parameters.AddWithValue("@COUNTERID", ObjCounter.COUNTERID); cmd.Parameters.AddWithValue("@USERID", ObjCounter.UserID); object objReturn = cmd.ExecuteScalar(); string str = Convert.ToString(objReturn); if (!int.TryParse(str, out CounterID)) { throw new Exception(str); } else { ObjCounter.COUNTERID = objReturn; } } } catch (Exception ex) { throw new Exception("Error While Deleteing Counter"); } finally { SQLCon.Sqlconn().Close(); } return(ObjCounter); }
/// <summary> /// Code to fetch PRoject, Organization and customer details at once /// </summary> /// <param name="ProjectID"></param> /// <returns></returns> public DataTable GetProjectCustomerDetails(int ProjectID) { DataTable dt = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[P_Rpt_ProjectAndCustomerAndOTTODetails]"; cmd.Parameters.AddWithValue("@ProjectID", ProjectID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) da.Fill(dt); } } catch (Exception ex) { throw; } finally { SQLCon.Close(); } return(dt); }
public Branch DeleteBranch(Branch ObjBranch) { int BRanchID = 0; try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_D_BRANCH]"; cmd.Parameters.AddWithValue("@BRANCHID", ObjBranch.BRANCHID); cmd.Parameters.AddWithValue("@USERID", ObjBranch.UserID); object objReturn = cmd.ExecuteScalar(); string str = Convert.ToString(objReturn); if (!int.TryParse(str, out BRanchID)) { throw new Exception(str); } else { ObjBranch.BRANCHID = objReturn; } } } catch (Exception ex) { throw new Exception("Error While Deleteing Branch"); } finally { SQLCon.Sqlconn().Close(); } return(ObjBranch); }
/// <summary> /// Code to get LV sections for import /// </summary> /// <param name="ProjectID"></param> /// <returns></returns> public DataTable GetLVSection(int ProjectID) { DataTable dtLVSecton = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[P_Get_LVSectionForImport]"; cmd.Parameters.Add("@ProjectID", ProjectID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dtLVSecton); } } } catch (Exception ex) { if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE") { throw new Exception("Fehler beim Laden der LV Sektion"); } else { throw new Exception("Error Occured While Retreiving LV Sections"); } } finally { SQLCon.Close(); } return(dtLVSecton); }
public DataTable GetUOM() { DataTable dtUOM = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_UOM]"; using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dtUOM); } } } catch (Exception ex) { throw new Exception("Error While Retrieving UOM List"); } finally { SQLCon.Sqlconn().Close(); } return(dtUOM); }
public DataTable UpdateInvoice(StockEntry ObjStockEntry) { DataTable dt = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_U_STOCKENTRY]"; cmd.Parameters.AddWithValue("@STOCKENTRYID", ObjStockEntry.STOCKENTRYID); cmd.Parameters.AddWithValue("@TCS", ObjStockEntry.TCS); cmd.Parameters.AddWithValue("@DISCOUNTPER", ObjStockEntry.DISCOUNTPER); cmd.Parameters.AddWithValue("@DISCOUNTFLAT", ObjStockEntry.DISCOUNTFLAT); cmd.Parameters.AddWithValue("@EXPENSES", ObjStockEntry.EXPENSES); cmd.Parameters.AddWithValue("@TRANSPORT", ObjStockEntry.TRANSPORT); cmd.ExecuteNonQuery(); } } catch (Exception ex) { throw new Exception("Error While Updating Invoice"); } finally { SQLCon.Sqlconn().Close(); } return(dt); }
public UOM DeleteUOM(UOM ObjUOM) { int UOMID = 0; try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_D_UOM]"; cmd.Parameters.AddWithValue("@UOMID", ObjUOM.UOMID); cmd.Parameters.AddWithValue("@USERID", ObjUOM.UserID); object objReturn = cmd.ExecuteScalar(); string str = Convert.ToString(objReturn); if (!int.TryParse(str, out UOMID)) { throw new Exception(str); } else { ObjUOM.UOMID = objReturn; } } } catch (Exception ex) { throw new Exception("Error While Deleteing UOM"); } finally { SQLCon.Sqlconn().Close(); } return(ObjUOM); }
public DataTable GetStockSummary(object branchID, object itemID) { DataTable dt = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_STOCKSUMMARY]"; cmd.Parameters.AddWithValue("@BranchID", branchID); cmd.Parameters.AddWithValue("@ItemID", itemID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); } } } catch (Exception ex) { throw new Exception("Error While Retreiving stock summary", ex); } finally { SQLCon.Sqlconn().Close(); } return(dt); }
public DataTable GetStockCountingDetail(object StockCountingID) { DataTable dtStockCountingDetail = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_STOCKCOUNTINGDETAIL]"; cmd.Parameters.AddWithValue("@STOCKCOUNTINGID", StockCountingID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dtStockCountingDetail); } } } catch (Exception ex) { throw new Exception("Error While Retrieving Stock Counting Detail", ex); } finally { SQLCon.Sqlconn().Close(); } return(dtStockCountingDetail); }
public DataSet GetDispatchDC(object DispatchDCID) { DataSet ds = new DataSet(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_STOCKDISPATCHDC]"; cmd.Parameters.AddWithValue("@DISPATCHDCID", DispatchDCID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } } } catch (Exception ex) { throw new Exception("Error While Retreiving Dispatch DC", ex); } finally { SQLCon.Sqlconn().Close(); } return(ds); }
public DataTable GetStockCountingDiff(object BranchID) { DataTable dtStockCountingDiff = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_STOCKCONTINGDIFF]"; cmd.Parameters.AddWithValue("@BRANCHID", BranchID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dtStockCountingDiff); } } } catch (Exception ex) { throw new Exception("Error While Retrieving Stock Counting Difference", ex); } finally { SQLCon.Sqlconn().Close(); } return(dtStockCountingDiff); }
public DataTable GetCurrentStock(object FROMBRANCHID, object TOBRANCHID, object ITEMCODEID, object PARENTITEMID) { DataTable dt = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_CURRENTSTOCK]"; cmd.Parameters.AddWithValue("@FROMBRANCHID", FROMBRANCHID); cmd.Parameters.AddWithValue("@TOBRANCHID", TOBRANCHID); cmd.Parameters.AddWithValue("@ITEMCODEID", ITEMCODEID); cmd.Parameters.AddWithValue("@PARENTITEMID", PARENTITEMID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); } } } catch (Exception ex) { throw new Exception("Error While Retreiving Current Stock", ex); } finally { SQLCon.Sqlconn().Close(); } return(dt); }
/// <summary> /// Code to get Article groups based on LV section for Multi5 module /// </summary> /// <param name="ObjEMulti"></param> /// <returns></returns> public EMulti GetArticleGroups(EMulti ObjEMulti) { try { ObjEMulti.dtArticles = new DataTable(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[P_Get_WGForMulti]"; cmd.Parameters.Add("@ProjectID", ObjEMulti.ProjectID); cmd.Parameters.Add("@LVSection", ObjEMulti.LVSection); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ObjEMulti.dtArticles); } } } catch (Exception ex) { if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE") { throw new Exception("Fehler beim Laden der Artikelgruppen"); } else { throw new Exception("Error while retrieving article groups"); } } finally { SQLCon.Close(); } return(ObjEMulti); }
/// <summary> /// Code to Get Form blatt articles mapping /// </summary> /// <param name="ObjEFormBlatt"></param> /// <returns></returns> public EFormBlatt GetFormBlattMapping(EFormBlatt ObjEFormBlatt) { try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[P_Get_FormBlattMapping]"; cmd.Parameters.Add("@ProjectID", ObjEFormBlatt.ProjectID); Object ObjReturn = cmd.ExecuteScalar(); if (!string.IsNullOrEmpty(Convert.ToString(ObjReturn))) { throw new Exception("Bitte weisen Sie dem Kostentyp 'Nachunternehmerleistungen/Stoffkosten' Warengruppen-/arten zu"); } } } catch (Exception ex) { throw; } finally { SQLCon.Close(); } return(ObjEFormBlatt); }
public DataTable GetBillDetailByID(object CounterID, object DayClosureID) { DataTable dtbillDetail = new DataTable(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_R_BILLDETAILBYID]"; cmd.Parameters.AddWithValue("@BRANCHCOUNTERID", CounterID); cmd.Parameters.AddWithValue("@BILLID", DayClosureID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dtbillDetail); } } } catch (Exception ex) { throw new Exception("Error While Retrieving bill Detail", ex); } finally { SQLCon.Sqlconn().Close(); } return(dtbillDetail); }