private void LoadCompany() { Company objCompany = new Company(); DataTable dt = new DataTable(); try { ddlCompany.Items.Clear(); dt = objCompany.GetCompanyListForPurchaseInvoiceLog(Convert.ToInt32(Session["CompanyID"]), Convert.ToInt32(Session["UserID"]), Convert.ToInt32(Session["UserTypeID"])); if (dt.Rows.Count > 0) { ddlCompany.DataSource = dt; ddlCompany.DataBind(); ddlCompany.SelectedValue = dt.Rows[0][0].ToString(); } } catch (Exception ex) { CMScode.SendEmail("*****@*****.**", "*****@*****.**", "", "", "CMS ERROR", "CMS LoadCompany : <br /> " + ex.Message.ToString()); } finally { dt = null; ddlCompany.Items.Insert(0, new ListItem("Select Company Name", "0")); ddlDepartment.Items.Insert(0, new ListItem("Select Department", "0")); ddlWeekStartDate.Items.Insert(0, new ListItem("Select Week Start Date", "0")); ddlCompany.SelectedValue = "0"; } }
private void LoadWeekSartDate() { ddlWeekStartDate.Items.Clear(); string ConsString = ConfigurationManager.AppSettings["ConnectionString"].ToString(); SqlConnection sqlConn = new SqlConnection(ConsString); SqlDataAdapter sqlDA = new SqlDataAdapter("Sp_WeekSartDate", sqlConn); sqlDA.SelectCommand.CommandType = CommandType.StoredProcedure; sqlDA.SelectCommand.Parameters.Add("@DepartmentID", Convert.ToInt32(ddlDepartment.SelectedValue)); DataSet ds = new DataSet(); try { sqlConn.Open(); sqlDA.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { ddlWeekStartDate.DataSource = ds; ddlWeekStartDate.DataBind(); } } catch (Exception ex) { CMScode.SendEmail("*****@*****.**", "*****@*****.**", "", "", "CMS ERROR", "CMSHistory.Aspx LoadWeekSartDate: <br /> " + ex.Message.ToString()); } finally { sqlConn.Close(); sqlDA.Dispose(); ds = null; ddlWeekStartDate.Items.Insert(0, new ListItem("Select Week Start Date", "0")); } }
public static int checkstatusCMS(int depID) { int iReturnValue = 0; SqlCommand sqlCmd = null; SqlParameter sqlReturnParam = null; string ConsString = ConfigurationManager.AppSettings["ConnectionString"].ToString(); SqlConnection sqlConn = new SqlConnection(ConsString); sqlCmd = new SqlCommand("Sp_CheckWeeklySummary_CMS", sqlConn); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.Add("@depID", Convert.ToInt32(depID)); sqlReturnParam = sqlCmd.Parameters.Add("ReturnValue", SqlDbType.Int); sqlReturnParam.Direction = ParameterDirection.ReturnValue; try { sqlConn.Open(); sqlCmd.ExecuteNonQuery(); iReturnValue = Convert.ToInt32(sqlReturnParam.Value); } catch (Exception ex) { CMScode.SendEmail("*****@*****.**", "*****@*****.**", "", "", "CMS ERROR", "CMScode: <br /> " + ex.Message.ToString()); } finally { sqlReturnParam = null; sqlCmd.Dispose(); sqlConn.Close(); } return(iReturnValue); }