public int Save(PriviledgeDB objDB, SqlTransaction objTrans) { int PriviledgeID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "usp_Priviledges"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@FormID", objDB.FormID); objCmd.Parameters.AddWithValue("@RoleID", objDB.RoleID); objCmd.Parameters.AddWithValue("@viewing", objDB.viewing); objCmd.Parameters.AddWithValue("@PriviledgeID", SqlDbType.Int); objCmd.Parameters["@PriviledgeID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); PriviledgeID = Convert.ToInt32(objCmd.Parameters["@PriviledgeID"].Value); return PriviledgeID; } catch (Exception ex) { throw ex; } }
public void SaveMonthOpenClose(MonthOpenCloseDB objDB, SqlTransaction objTrans) { DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "usp_SaveMonthOpenClose"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@MonthID", objDB.MonthID); objCmd.Parameters.AddWithValue("@YearID", objDB.YearID); objCmd.Parameters.AddWithValue("@Status", objDB.Status); objCmd.Parameters.AddWithValue("@id", SqlDbType.Int); objCmd.Parameters["@id"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); } catch (Exception ex) { throw ex; } }
public int getModelMapping(Int64 TractorNo, SqlTransaction objTrans) { int ModelMappingID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "usp_getModelMappingID"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@TRACTOR_NO", TractorNo); objCmd.Parameters.AddWithValue("@ModelMappingID", SqlDbType.Int); objCmd.Parameters["@ModelMappingID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); ModelMappingID = Convert.ToInt32(objCmd.Parameters["@ModelMappingID"].Value); } catch (Exception ex) { throw ex; } return ModelMappingID; }
public int SaveBudget(BudgetDB objDB, SqlTransaction objTrans) { int ID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "usp_SaveBudget"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@FinancialYear", objDB.FinancialYear); objCmd.Parameters.AddWithValue("@QuarterID", objDB.QuarterID); objCmd.Parameters.AddWithValue("@Budget", objDB.Budget); objCmd.Parameters.AddWithValue("@ModelGroupID", objDB.ModelGroupID); objCmd.Parameters.AddWithValue("@ModelCategoryID", objDB.ModelCategoryID); objCmd.Parameters.AddWithValue("@ModelClutchID", objDB.ModelClutchID); objCmd.Parameters.AddWithValue("@ModelSpecialID", objDB.ModelSpecialID); objCmd.Parameters.AddWithValue("@ID", SqlDbType.Int); objCmd.Parameters["@ID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); ID = Convert.ToInt32(objCmd.Parameters["@ID"].Value); return ID; } catch (Exception ex) { throw ex; } }
public int CheckMaterial(ModelDB objDB, SqlTransaction objTrans) { int flag = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "Usp_CheckMaterial"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@Material", objDB.Material); objCmd.Parameters.AddWithValue("@flag", SqlDbType.Int); objCmd.Parameters["@flag"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); flag = Convert.ToInt32(objCmd.Parameters["@flag"].Value); return flag; } catch (Exception ex) { throw ex; } }
public int SaveReworkCost(ReworkCostDB objDB, SqlTransaction objTrans) { int ID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "usp_SaveReworkCost"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@MonthID", objDB.MonthID); objCmd.Parameters.AddWithValue("@YearID", objDB.YearID); objCmd.Parameters.AddWithValue("@ModelGroupID", objDB.GroupID); objCmd.Parameters.AddWithValue("@ReworkCost_I_Year", objDB.ReworkCost_I_Year); objCmd.Parameters.AddWithValue("@ReworkCost_II_Year", objDB.ReworkCost_II_Year); objCmd.Parameters.AddWithValue("@ModelCategoryID", objDB.ModelCategoryID); objCmd.Parameters.AddWithValue("@HMR_Range", objDB.HMR_Range); objCmd.Parameters.AddWithValue("@ID", SqlDbType.Int); objCmd.Parameters["@ID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); ID = Convert.ToInt32(objCmd.Parameters["@ID"].Value); return ID; } catch (Exception ex) { throw ex; } }
public int DeleteGroupName(ConfiguratorDB objDB, SqlTransaction objTrans) { int StatusID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { if (objDB.source == "Model") { objCmd.CommandText = "Usp_DeleteGroupName"; } if (objDB.source == "Culprit") { objCmd.CommandText = "Usp_DeletCulpritGroup"; } if (objDB.source == "Defect") { objCmd.CommandText = "Usp_DeleteDefectGroup"; } if (objDB.source == "Cvoice") { objCmd.CommandText = "Usp_DeleteCvoiceGroup"; } if (objDB.source == "Item") { objCmd.CommandText = "Usp_DeleteItemGroup"; } objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@GroupID", objDB.GroupID); objCmd.Parameters.AddWithValue("@StatusID", SqlDbType.Int); objCmd.Parameters["@StatusID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); StatusID = Convert.ToInt32(objCmd.Parameters["@StatusID"].Value); return StatusID; } catch (Exception ex) { throw ex; } }
public int SaveDealer(DealerDB objDB, SqlTransaction objTrans) { int DealerID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { if (objDB.CheckID == 0) { objCmd.CommandText = "usp_SaveDealer"; } else { objCmd.CommandText = "usp_UpdateDealer"; objCmd.Parameters.AddWithValue("@Id", objDB.Id); } objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@Dealer", objDB.Dealer); objCmd.Parameters.AddWithValue("@Code", objDB.Code); objCmd.Parameters.AddWithValue("@RegionID", objDB.RegionID); objCmd.Parameters.AddWithValue("@City", objDB.City); objCmd.Parameters.AddWithValue("@InstallerName", objDB.InstallerName); objCmd.Parameters.AddWithValue("@IsActive", objDB.IsActive); objCmd.Parameters.AddWithValue("@IsOperatingDealer", objDB.IsOperatingDealer); objCmd.Parameters.AddWithValue("@DealerID", SqlDbType.Int); objCmd.Parameters["@DealerID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); DealerID = Convert.ToInt32(objCmd.Parameters["@DealerID"].Value); return DealerID; } catch (Exception ex) { throw ex; } }
public int AddCulprit(CulpritDB objDB, SqlTransaction objTrans) { DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); int Status = 0; try { if (objDB.StatusID == 0) { objCmd.CommandText = "usp_AddCulprit"; } else { objCmd.CommandText = "usp_UpdateCulprit"; } objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@Code", objDB.CulpritCode); objCmd.Parameters.AddWithValue("@GroupID", objDB.GroupID); objCmd.Parameters.AddWithValue("@Description", objDB.Description); objCmd.Parameters.AddWithValue("@IsActive", objDB.IsActive); objCmd.Parameters.AddWithValue("@InReport", objDB.InReport); objCmd.Parameters.AddWithValue("@IsGroup", objDB.IsGroup); objCmd.Parameters.AddWithValue("@EffectDate", objDB.EffectDate); objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); // Status = Convert.ToInt32(objCmd.Parameters["@Status"].Value); } catch (Exception ex) { throw ex; } return Status; }
public int SaveRole(RoleDB objDB, SqlTransaction objTrans) { int RoleID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { if (objDB.CheckID == 0) { objCmd.CommandText = "usp_SaveRole"; } else { objCmd.CommandText = "usp_UpdateRole"; objCmd.Parameters.AddWithValue("@Id", objDB.Id); } objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@Role", objDB.Role); objCmd.Parameters.AddWithValue("@IsActive", objDB.IsActive); objCmd.Parameters.AddWithValue("@RoleID", SqlDbType.Int); objCmd.Parameters["@RoleID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); RoleID = Convert.ToInt32(objCmd.Parameters["@RoleID"].Value); return RoleID; } catch (Exception ex) { throw ex; } }
public int SaveBulkAcr( SqlTransaction objTrans) { int ID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "usp_AcrBulkDataInsert"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@count", SqlDbType.Int); objCmd.Parameters["@count"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); ID = Convert.ToInt32(objCmd.Parameters["@count"].Value); } catch (Exception ex) { throw ex; } return ID; }
public void SaveAcrData(SqlTransaction objTrans) { DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "usp_AcrDataInsert"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); } catch (Exception ex) { throw ex; } }
public int Save(ConfiguratorDB objDB, SqlTransaction objTrans) { int modelGroupID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "usp_SaveProductGroupMapping"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@ModelGroupName", objDB.ModelGroupName); objCmd.Parameters.AddWithValue("@IsNew", objDB.IsNew); objCmd.Parameters.AddWithValue("@WarrantyPeriod", objDB.WarrantyPeriod); objCmd.Parameters.AddWithValue("@ProductGroupMappingID", SqlDbType.Int); objCmd.Parameters["@ProductGroupMappingID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); modelGroupID = Convert.ToInt32(objCmd.Parameters["@ProductGroupMappingID"].Value); return modelGroupID; } catch (Exception ex) { throw ex; } }
public int SaveProductGroupMapping(ConfiguratorDB objDB, SqlTransaction objTrans) { int modelGroupID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { if (objDB.source == "Configurator") { objCmd.CommandText = "usp_SaveProductCodeMapping"; } else { objCmd.CommandText = "usp_SaveModelException"; } objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@ProductCodeID", objDB.ID); objCmd.Parameters.AddWithValue("@GroupID", objDB.GroupID); objCmd.Parameters.AddWithValue("@ProductCodeMappingID", SqlDbType.Int); objCmd.Parameters["@ProductCodeMappingID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); modelGroupID = Convert.ToInt32(objCmd.Parameters["@ProductCodeMappingID"].Value); return modelGroupID; } catch (Exception ex) { throw ex; } }
public int SaveItem(ItemDB objDB, SqlTransaction objTrans) { DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); int Status = 0; try { objCmd.CommandText = "usp_UpdateItemException"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@ItemCode",objDB.ItemCode); objCmd.Parameters.AddWithValue("@ItemGroupName", objDB.ItemGroupName); objCmd.Parameters.AddWithValue("@GroupID", objDB.GroupID); objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); } catch (Exception ex) { throw ex; } return Status; }
public int SaveModelDetail(ModelDB objDB, SqlTransaction objTrans) { int MappingID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "Usp_SaveModelMapping"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@Material", objDB.Material); objCmd.Parameters.AddWithValue("@GroupID", objDB.GroupID); objCmd.Parameters.AddWithValue("@ModelSpecialID", objDB.ModelSpecialID); objCmd.Parameters.AddWithValue("@ClutchTypeID", objDB.ClutchTypeID); objCmd.Parameters.AddWithValue("@ModelCategoryID", objDB.ModelCategoryID); objCmd.Parameters.AddWithValue("@Description", objDB.Description); objCmd.Parameters.AddWithValue("@MappingID", SqlDbType.Int); objCmd.Parameters["@MappingID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); MappingID = Convert.ToInt32(objCmd.Parameters["@MappingID"].Value); return MappingID; } catch (Exception ex) { throw ex; } }
public int UpdateItemData(SqlTransaction objTrans) { DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); int Status = 0; try { objCmd.CommandText = "usp_ItemDataUpdate"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@Status", SqlDbType.Int); objCmd.Parameters["@Status"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); Status = Convert.ToInt32(objCmd.Parameters["@Status"].Value); } catch (Exception ex) { throw ex; } return Status; }
public int SaveModel(ModelDB objDB,int TempID ,SqlTransaction objTrans) { DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); int Status = 0; try { objCmd.CommandText = "usp_UpdateModelException"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@ProductCode", Convert.ToInt32(objDB.Code)); objCmd.Parameters.AddWithValue("@ModelGroupName", objDB.ModelCode); objCmd.Parameters.AddWithValue("@GroupID", objDB.GroupID); objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); } catch (Exception ex) { throw ex; } return Status; }
public int SaveAcr(AcrDB objDB,SqlTransaction objTrans) { int ID = 0; DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "usp_AcrInsert"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@WCDOCNO", objDB.WCDOCNO); objCmd.Parameters.AddWithValue("@DLR_REF", objDB.DLR_REF); objCmd.Parameters.AddWithValue("@TRACTOR_NO", objDB.TRACTOR_NO); objCmd.Parameters.AddWithValue("@ENGINE_NO", objDB.ENGINE_NO); objCmd.Parameters.AddWithValue("@INS_DATE", objDB.INS_DATE); objCmd.Parameters.AddWithValue("@DEF_DATE", objDB.DEF_DATE); objCmd.Parameters.AddWithValue("@REP_DATE", objDB.REP_DATE); objCmd.Parameters.AddWithValue("@HMR", objDB.HMR); objCmd.Parameters.AddWithValue("@DLR_CO", objDB.DLR_CO); objCmd.Parameters.AddWithValue("@DEALER_NAME", objDB.DEALER_NAME); objCmd.Parameters.AddWithValue("@REG", objDB.REG); objCmd.Parameters.AddWithValue("@CR_DATE", objDB.CR_DATE); objCmd.Parameters.AddWithValue("@ITEM_CODE", objDB.ITEM_CODE); objCmd.Parameters.AddWithValue("@DESCRIPTION", objDB.DESCRIPTION); objCmd.Parameters.AddWithValue("@QUANTITY", objDB.QUANTITY); objCmd.Parameters.AddWithValue("@COST", objDB.COST); objCmd.Parameters.AddWithValue("@DEF", objDB.DEF); objCmd.Parameters.AddWithValue("@NDP", objDB.NDP); objCmd.Parameters.AddWithValue("@VALUE", objDB.VALUE); objCmd.Parameters.AddWithValue("@CVOICE", objDB.CVOICE); objCmd.Parameters.AddWithValue("@OUTLV", objDB.OUTLV); objCmd.Parameters.AddWithValue("@DT", objDB.DT); objCmd.Parameters.AddWithValue("@CUL_CODE", objDB.CUL_CODE); objCmd.Parameters.AddWithValue("@BLANK", objDB.BLANK); objCmd.Parameters.AddWithValue("@CR_AMOUNT", objDB.CR_AMOUNT); objCmd.Parameters.AddWithValue("@AUTH_AMT", objDB.AUTH_AMOUNT); objCmd.Parameters.AddWithValue("@DIFF", objDB.DIFF); objCmd.Parameters.AddWithValue("@Production_Month", objDB.Production_Month); objCmd.Parameters.AddWithValue("@Production_Month_Year", objDB.Production_Month_Year); objCmd.Parameters.AddWithValue("@ModelMappingID", objDB.ModelMappingID); objCmd.Parameters.AddWithValue("@HMR_Range", objDB.HMR_Range); objCmd.Parameters.AddWithValue("@FromDate", objDB.FromDate); objCmd.Parameters.AddWithValue("@ToDate", objDB.ToDate); objCmd.Parameters.AddWithValue("@MonthID", objDB.MonthID); objCmd.Parameters.AddWithValue("@YearID", objDB.YearID); objCmd.Parameters.AddWithValue("@Quarter", objDB.Quarter); objCmd.Parameters.AddWithValue("@Engine", objDB.Engine); objCmd.Parameters.AddWithValue("@IsEngine", objDB.IsEngine); objCmd.Parameters.AddWithValue("@ID", SqlDbType.Int); objCmd.Parameters["@ID"].Direction = ParameterDirection.Output; objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); ID = Convert.ToInt32(objCmd.Parameters["@ID"].Value); } catch (Exception ex) { throw ex; } return ID; }
public void SaveDefect(MastersDB objDB, SqlTransaction objTrans) { DataAccessLayer objDataLayer = new DataAccessLayer(); SqlCommand objCmd = new SqlCommand(); try { objCmd.CommandText = "usp_DefectInsert"; objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@Code", Convert.ToInt32(objDB.Code)); objCmd.Parameters.AddWithValue("@Description", objDB.Description); objCmd.Transaction = objTrans; objCmd.Connection = objTrans.Connection; objDataLayer.Command = objCmd; objDataLayer.ExecQuery(); } catch (Exception ex) { throw ex; } }