Exemple #1
0
 protected void grdUserName_RowEditing(object sender, GridViewEditEventArgs e)
 {
     try
     {
         lblMsg.Text        = string.Empty;
         lblMsgEdit.Text    = string.Empty;
         lblMsg.Visible     = false;
         lblMsgEdit.Visible = false;
         int lngId = ML_Common.string2int32(grdUserName.DataKeys[e.NewEditIndex].Values[0].ToString());
         if (lngId > 0)
         {
             ViewState["grdUserNameEditId"] = lngId;
             grdUserName.EditIndex          = -1;
             e.Cancel = true;
             FormFieldsClear();
             FillObjectToForm(lngId, true);
             UpdatePanelEdit.Update();
             ModalPopupExtenderEdit.Show();
         }
         else
         {
             lblMsg.Visible = true;
             lblMsg.Text    = "Record is not exists?";
         }
     }
     catch (Exception ex)
     {
         Exception exc = ex;
     }
 }
        public int Update(ML_CanteenMaster objML_CanteenMaster)
        {
            int results = 0;

            try
            {
                sbTraceInformation = new StringBuilder();
                sbTraceInformation.Append("Entered:-Inside BusinessClasses-CanteenMaster:Update(ML_CanteenMaster");
                sbTraceInformation.Remove(0, sbTraceInformation.Length);

                SqlParameter ReturnObj = new SqlParameter("@ReturnObj", ParameterDirection.Output);
                ReturnObj.Direction = ParameterDirection.Output;
                SqlParameter[] parameters =
                {
                    #region Update Properties
                    new SqlParameter("@CanteenCode",    objML_CanteenMaster.CanteenCode),
                    new SqlParameter("@CanteenName",    objML_CanteenMaster.CanteenName),
                    new SqlParameter("@CanteenAddress", objML_CanteenMaster.CanteenAddress),
                    new SqlParameter("@CanteenActive",  objML_CanteenMaster.CanteenActive),
                    ReturnObj
                    #endregion
                };

                this.Parameters = parameters;
                SqlHelper.ExecuteNonQuery(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_UpdateCanteenMaster.ToString(), this.Parameters);

                sbTraceInformation.Append("Exit:-From BusinessClasses-CanteenMaster:Update(ML_CanteenMaster");
                sbTraceInformation.Remove(0, sbTraceInformation.Length);

                if (ReturnObj.Value != null)
                {
                    results = ML_Common.string2int32(ReturnObj.Value.ToString());
                }
            }
            catch (SqlException sqlExc)
            {
                int errNumber = int.MinValue;
                //LogManager.LogManager.WriteErrorLog(sqlExc);
                foreach (SqlError error in sqlExc.Errors)
                {
                    errNumber = error.Number;
                }
                if (errNumber == 50000)
                {
                    results = 999;
                    throw;
                }
            }
            catch (Exception ex)
            {
                results = 0;
                Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                throw;
            }
            finally
            {
                //LogManager.LogManager.WriteTraceLog(sbTraceInformation.ToString());
            }
            return(results);
        }
        protected void grdSanitizationReport_RowEditing(object sender, GridViewEditEventArgs e)
        {
            try
            {
                lblMsg.Text = string.Empty;


                int lngId = ML_Common.string2int32(grdSanitizationReport.DataKeys[e.NewEditIndex].Values[0].ToString());
                if (lngId > 0)
                {
                    ViewState["grdSanitizationReportId"] = lngId;
                    grdSanitizationReport.EditIndex      = -1;
                    e.Cancel = true;
                    //FormFieldsClear();
                    // FillObjectToForm(lngId, true);

                    //  UpdatePanelMsg.Update();
                    // ModalPopupExtenderMsg.Show();
                }
                else
                {
                    lblMsg.Text = "Record is not exists?";
                }
            }
            catch (Exception ex)
            {
                Exception exc = ex;
            }
        }
Exemple #4
0
        protected void grdItemMaster_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("ADD"))
            {
                DropDownList ddlNewCanteenName       = (DropDownList)grdItemMaster.FooterRow.FindControl("ddlNewCanteenName");
                DropDownList ddlNewCategoryGroupCode = (DropDownList)grdItemMaster.FooterRow.FindControl("ddlNewCategoryGroupCode");
                DropDownList ddlNewCategoryItemCode  = (DropDownList)grdItemMaster.FooterRow.FindControl("ddlNewCategoryItemCode");

                TextBox  txtNewItemName         = (TextBox)grdItemMaster.FooterRow.FindControl("txtNewItemName");
                TextBox  txtNewItemEmployeeRate = (TextBox)grdItemMaster.FooterRow.FindControl("txtNewItemEmployeeRate");
                CheckBox ChStatusNew            = (CheckBox)grdItemMaster.FooterRow.FindControl("ChStatusNew");
                if (IsValid)
                {
                    //errNumber = -1;
                    try
                    {
                        objBusinessClass = new BusinessLayer.BusinessClass();
                        objML_ItemMaster = new ML_ItemMaster();

                        objML_ItemMaster.CanteenCode       = Convert.ToInt32(ML_Common.clean(ddlNewCanteenName.SelectedValue));
                        objML_ItemMaster.CategoryGroupCode = Convert.ToInt32(ML_Common.clean(ddlNewCategoryGroupCode.SelectedValue));
                        objML_ItemMaster.ItemCategoryCode  = Convert.ToInt32(ML_Common.clean(ddlNewCategoryItemCode.SelectedValue));
                        objML_ItemMaster.ItemName          = ML_Common.clean(txtNewItemName.Text);
                        objML_ItemMaster.ItemEmployeeRate  = Convert.ToDecimal(ML_Common.clean(txtNewItemEmployeeRate.Text));
                        if (ChStatusNew.Checked)
                        {
                            objML_ItemMaster.ItemActive = 1;
                        }
                        else
                        {
                            objML_ItemMaster.ItemActive = 0;
                        }

                        int obhReturn = objBusinessClass.AddItemMaster(objML_ItemMaster);

                        if (obhReturn == 1)
                        {
                            lblMsg.Visible = true;
                            lblMsg.Text    = "Record Saved Successfully";
                            FillGrid();
                        }
                        else if (obhReturn == 2)
                        {
                            lblMsg.Text    = "Record Already Exists!";
                            lblMsg.Visible = true;
                        }
                    }
                    catch (SqlException sqlExc)
                    {
                        // LogManager.LogManager.WriteErrorLog(sqlExc);
                        SqlException sqlEt = sqlExc;
                        return;
                    }
                    catch (Exception ex)
                    {
                        Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                    }
                }
            }
        }
 protected void lnkbtnHome_Click(object sender, EventArgs e)
 {
     try
     {
         if (Session["UserTypeId"] != null)
         {
             if (ML_Common.string2int(Session["UserTypeId"]) == 3) //Lab
             {
                 Server.Transfer("~/frmLabDashBoard.aspx", false);
             }
             else if (ML_Common.string2int(Session["UserTypeId"]) == 2) //TeachTeam
             {
                 Server.Transfer("~/frmDashBoard.aspx", false);
             }
             else if (ML_Common.string2int(Session["UserTypeId"]) == 1) //Admin
             {
                 Server.Transfer("~/frmDashBoard.aspx", false);
             }
             else
             {
                 Response.Redirect("~/SignedOff.html");
             }
         }
         else
         {
             Response.Redirect("~/SignedOff.html");
         }
     }
     catch (Exception ex)
     {
         Exception exx = ex;
     }
 }
        private void FillObjectToForm(long lngId, bool IsEditFlag = true)
        {
            objBusinessClass = new BusinessLayer.BusinessClass();
            try
            {
                if (ViewState["ReportType"] != null && ViewState["grdSanitizationReportId"] != null)
                {
                    string ReportType = ML_Common.string2string(ViewState["ReportType"].ToString());
                    lngId = ML_Common.string2Long(ViewState["grdSanitizationReportId"].ToString());

                    // string ReportType = ML_Common.GetDropDownValue(ddlReportTypeSearch, true);
                    ML_SanitizationReport objML_SanitizationReport = objBusinessClass.GetSCSanitizationResultByReportTypeandId(lngId, ReportType);

                    if (objML_SanitizationReport != null)
                    {
                        //ViewState["SanitizationResultId"] = objML_SanitizationReport.SanitizationResultId;
                        //ViewState["SanitizationStartDate"] = objML_SanitizationReport.SanitizationStartDate;
                        //ViewState["SanitizationEndDate"] = objML_SanitizationReport.SanitizationEndDate;
                        //FillGridForData();
                        ShowReport(objML_SanitizationReport.Id, objML_SanitizationReport.ReportType);
                    }
                    //UpdatePanelGridResult.Update();
                }
            }
            catch (Exception ex)
            {
                Exception exc = ex;
            }
        }
Exemple #7
0
        public override string Get(string name)
        {
            string decryptedValue = null;
            string baseKey        = null;

            string[] keys = AllKeys;
            for (int i = 0; i < keys.Length; i++)
            {
                string key = keys[i];
                if (name == ML_Common.Decrypt(key))
                {
                    baseKey = key;
                    break;
                }
            }

            if (baseKey != null)
            {
                string encryptedValue = base.Get(baseKey);
                if (encryptedValue != null)
                {
                    decryptedValue = ML_Common.Decrypt(encryptedValue);
                }
            }

            return(decryptedValue);
        }
        protected void grdCokeDynamicResult_RowEditing(object sender, GridViewEditEventArgs e)
        {
            try
            {
                lblMsg.Text    = string.Empty;
                lblMsg.Visible = false;

                int lngId = ML_Common.string2int32(grdCokeDynamicResult.DataKeys[e.NewEditIndex].Values[0].ToString());
                if (lngId > 0)
                {
                    ViewState["grdCokeDynamicResultViewId"] = lngId;
                    grdCokeDynamicResult.EditIndex          = -1;
                    e.Cancel = true;
                    // PanelMainDisplay(false);
                    FormFieldsClear();
                    //PanelEditFormDisplay(true);
                    //FillObjectToForm(lngId, true);
                    //UpdatePanelEdit.Update();
                    //ModalPopupExtenderEdit.Show();
                }
                else
                {
                    lblMsg.Text    = "Record is not exists?";
                    lblMsg.Visible = true;
                }
            }
            catch (Exception ex)
            {
                Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex);
            }
        }
        protected void grdCokeDynamic_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {
            try
            {
                lblMsg.Text = string.Empty;

                // Guid  guid = ML_Common.String2Guid(grdCokeComposite.DataKeys[e.NewSelectedIndex].Values[0].ToString());
                //int lngId = ML_Common.string2int(grdCokeComposite.DataKeys[e.NewSelectedIndex].Values[0].ToString());
                int lngId = ML_Common.string2int32(grdCokeDynamic.DataKeys[e.NewSelectedIndex].Values[0].ToString());
                ViewState["grdCokeDynamicId"] = lngId;
                if (lngId > 0)
                {
                    FormFieldsClear();
                    //FillObjectToForm(lngId, false);
                    // UpdatePanelView.Update();
                    //ModalPopupExtenderView.Show();
                }
                else
                {
                    lblMsg.Text = "Record is not exists?";
                }
                UpdatePanelCokeDynamicDisplay.Update();
            }
            catch (Exception ex)
            {
                Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex);
            }
        }
Exemple #10
0
        protected void grdCokeSupplier_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {
            try
            {
                lblMsg.Text    = string.Empty;
                lblMsg.Visible = false;

                int lngId = ML_Common.string2int32(grdCokeSupplier.DataKeys[e.NewSelectedIndex].Values[0].ToString());
                ViewState["grdCokeSupplierId"] = lngId;
                if (lngId > 0)
                {
                    FormFieldsClear();
                    FillObjectToForm(lngId, false);
                    UpdatePanelView.Update();
                    ModalPopupExtenderView.Show();
                }
                else
                {
                    lblMsg.Text    = "Record is not exists?";
                    lblMsg.Visible = true;
                }
            }
            catch (Exception ex)
            {
                Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex);
            }
        }
        private void WriteUserActivity(string strActivity, string strLogStatus = "")
        {
            if (Session["UserName"] != null && Session["UserNameId"] != null && Session["UserTypeId"] != null && Session["UserType"] != null && Session["IPAddress"] != null && Session["hostName"] != null)
            {
                ML_UserLog objML_UserLog = new ML_UserLog();
                objBusinessClass = new BusinessLayer.BusinessClass();
                try
                {
                    objML_UserLog.UserLog         = ML_Common.string2string(Session["UserName"]);
                    objML_UserLog.UserName        = ML_Common.string2string(Session["UserName"]);
                    objML_UserLog.UserNameId      = ML_Common.string2Long(Session["UserNameId"]);
                    objML_UserLog.Email           = string.Empty;
                    objML_UserLog.UserTypeId      = ML_Common.string2Long(Session["UserTypeId"]);
                    objML_UserLog.UserType        = ML_Common.string2string(Session["UserType"]);
                    objML_UserLog.LogStatus       = strLogStatus;
                    objML_UserLog.IPAddress       = ML_Common.string2string(Session["IPAddress"]);
                    objML_UserLog.MachineHostName = ML_Common.string2string(Session["hostName"]);

                    objML_UserLog.UserActivity = strActivity;
                    objML_UserLog.Remarks      = string.Empty;
                    objBusinessClass.AddUserLog(objML_UserLog);
                }
                catch { }
            }
            else
            {
                Response.Redirect("Login.aspx", false);
            }
        }
Exemple #12
0
        protected void grdUserName_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {
            try
            {
                lblMsg.Text    = string.Empty;
                lblMsg.Visible = false;
                int lngId = ML_Common.string2int32(grdUserName.DataKeys[e.NewSelectedIndex].Values[0].ToString());
                ViewState["UserNameViewId"] = lngId;

                if (lngId > 0)
                {
                    // e.Cancel = true;

                    FormFieldsClear();

                    FillObjectToForm(lngId, false);
                    UpdatePanelView.Update();
                    ModalPopupExtenderView.Show();
                }
                else
                {
                    lblMsg.Visible = true;
                    lblMsg.Text    = "Record is not exists?";
                }
            }
            catch (Exception ex)
            {
                Exception exx = ex;
            }
        }
        public int Update(ML_CokeType objML_CokeType)
        {
            int results = 0;

            try
            {
                SqlParameter ReturnObj = new SqlParameter("@ReturnObj", ParameterDirection.Output);
                ReturnObj.Direction = ParameterDirection.Output;
                SqlParameter[] parameters =
                {
                    #region Update Properties
                    new SqlParameter("@Id",                  objML_CokeType.Id),
                    new SqlParameter("@CokeTypeId",          objML_CokeType.CokeTypeId),
                    new SqlParameter("@CokeType",            objML_CokeType.CokeType),
                    new SqlParameter("@Remarks",             objML_CokeType.Remarks),
                    new SqlParameter("@IsActive",            objML_CokeType.IsActive),
                    new SqlParameter("@IsArchive",           objML_CokeType.IsArchive),
                    //new SqlParameter("@CreatedDate", objML_CokeType.CreatedDate),
                    //new SqlParameter("@CreatedBy", objML_CokeType.CreatedBy),
                    //new SqlParameter("@ModifiedDate", objML_CokeType.ModifiedDate),
                    new SqlParameter("@ModifiedBy",          objML_CokeType.ModifiedBy),
                    new SqlParameter("@CreatedByUserNameId", objML_CokeType.CreatedByUserNameId),
                    ReturnObj
                    #endregion
                };

                this.Parameters = parameters;
                SqlHelper.ExecuteNonQuery(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_UpdateCokeType.ToString(), this.Parameters);



                if (ReturnObj.Value != null)
                {
                    results = ML_Common.string2int32(ReturnObj.Value.ToString());
                }
            }
            catch (SqlException sqlExc)
            {
                SqlException sqlExt = sqlExc;
                throw;
            }
            catch (Exception ex)
            {
                results = 0;
                Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                throw;
            }
            finally
            {
                //LogManager.LogManager.WriteTraceLog(
            }
            return(results);
        }
Exemple #14
0
        protected void grdCanteenMaster_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("ADD"))
            {
                TextBox txtNewCanteenTypeName = (TextBox)grdCanteenMaster.FooterRow.FindControl("txtNewCanteenTypeName");

                CheckBox txtNewRemarks = (CheckBox)grdCanteenMaster.FooterRow.FindControl("txtNewRemarks");
                if (IsValid)
                {
                    //errNumber = -1;
                    try
                    {
                        objBusinessClass = new BusinessLayer.BusinessClass();
                        objML_CokeType   = new ML_CokeType();

                        objML_CokeType.CokeType     = ML_Common.clean(txtNewCanteenTypeName.Text);
                        objML_CokeType.Remarks      = ML_Common.clean(txtNewRemarks.Text);
                        objML_CokeType.IsActive     = ML_Common.clean(ML_Common.bit2int(false).ToString());
                        objML_CokeType.IsArchive    = ML_Common.clean(ML_Common.bit2int(false).ToString());
                        objML_CokeType.CreatedDate  = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString());
                        objML_CokeType.CreatedBy    = Session["UserName"].ToString();
                        objML_CokeType.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString());
                        objML_CokeType.ModifiedBy   = ML_Common.clean(string.Empty);

                        int obhReturn = objBusinessClass.AddCokeType(objML_CokeType);

                        if (obhReturn == 1)
                        {
                            lblMsg.Visible = true;
                            lblMsg.Text    = "Record Saved Successfully";
                            FillGrid();
                        }
                        else if (obhReturn == 2)
                        {
                            lblMsg.Text    = "Record Already Exists!";
                            lblMsg.Visible = true;
                        }
                    }
                    catch (SqlException sqlExc)
                    {
                        // LogManager.LogManager.WriteErrorLog(sqlExc);
                        SqlException sqlEt = sqlExc;
                        return;
                    }
                    catch (Exception ex)
                    {
                        Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                    }
                }
            }
        }
Exemple #15
0
        protected void grdCanteenMaster_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            TextBox txtCanteenTypeNameEdit = (TextBox)grdCanteenMaster.Rows[e.RowIndex].FindControl("txtCanteenTypeNameEdit");
            //TextBox txtRemarksEdit = (TextBox)grdCanteenMaster.Rows[e.RowIndex].FindControl("txtRemarksEdit");
            CheckBox txtRemarksEdit = (CheckBox)grdCanteenMaster.Rows[e.RowIndex].FindControl("txtRemarksEdit");

            if (IsValid)
            {
                //errNumber = -1;
                BusinessClass objBusinessClass = new BusinessLayer.BusinessClass();
                int           lngId            = ML_Common.string2int(grdCanteenMaster.DataKeys[e.RowIndex].Values[0].ToString());
                ML_CokeType   objML_CokeType   = objBusinessClass.GetCokeTypeById(lngId);
                try
                {
                    if (objML_CokeType != null)
                    {
                        objML_CokeType.CokeType = ML_Common.clean(txtCanteenTypeNameEdit.Text);

                        objML_CokeType.Remarks = ML_Common.clean(txtRemarksEdit.Text);

                        int obhReturn = objBusinessClass.UpdateCokeType(objML_CokeType);
                        if (obhReturn == 1)
                        {
                            lblMsg.Visible = true;
                            lblMsg.Text    = "Record Update Successfully";
                        }
                        else if (obhReturn == 2)
                        {
                            lblMsg.Text    = "Ooops!OtherIssue...";
                            lblMsg.Visible = true;
                        }
                        else
                        {
                            lblMsg.Text    = "Ooops!OtherIssue...";
                            lblMsg.Visible = true;
                        }
                        grdCanteenMaster.EditIndex = -1;
                        FillGrid();
                    }
                }
                catch (SqlException sqlExc)
                {
                    SqlException sqlEt = sqlExc;
                    return;
                }
                catch (Exception ex)
                {
                    Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex);
                }
            }
        }
Exemple #16
0
        private void FillGrid()
        {
            try
            {
                DataTable DtList = null;


                if (ViewState["grdUserName"] == null)
                {
                    if (ddlUserTypeSearch.SelectedIndex > 0)
                    {
                        objML_UserName.UserTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlUserTypeSearch, true));
                        objML_UserName.UserType   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlUserTypeSearch, false));

                        DtList = BindGridViewBySearch(objML_UserName);
                        ViewState["grdUserName"] = DtList;
                    }
                }
                else
                {
                    DtList = (DataTable)ViewState["grdUserName"];
                }

                if (DtList != null)
                {
                    if (DtList.Rows.Count > 0)
                    {
                        grdUserName.DataSource = DtList;
                        grdUserName.DataBind();
                    }
                    else
                    {
                        DtList.Rows.Add(DtList.NewRow());
                        grdUserName.DataSource = DtList;
                        grdUserName.DataBind();

                        int TotalColumns = grdUserName.Rows[0].Cells.Count;
                        grdUserName.Rows[0].Cells.Clear();
                        grdUserName.Rows[0].Cells.Add(new TableCell());
                        grdUserName.Rows[0].Cells[0].ColumnSpan = TotalColumns;
                        grdUserName.Rows[0].Cells[0].Text       = "No Record Found";
                    }

                    UpdatePanelGrid.Update();
                }
            }
            catch (Exception ex)
            {
                Exception exx = ex;
            }
        }
        public int Add(ML_UserType objML_UserType)
        {
            int results = 0;

            try
            {
                SqlParameter ReturnObj = new SqlParameter("@ReturnObj", ParameterDirection.Output);
                ReturnObj.Direction = ParameterDirection.Output;
                SqlParameter[] parameters =
                {
                    #region Add Properties
                    //new SqlParameter("@Id", objML_UserType.Id),
                    //new SqlParameter("@UserTypeId", objML_UserType.UserTypeId),
                    new SqlParameter("@UserType",            objML_UserType.UserType),
                    new SqlParameter("@IsActive",            objML_UserType.IsActive),
                    new SqlParameter("@IsArchive",           objML_UserType.IsArchive),
                    //new SqlParameter("@CreatedDate", objML_UserType.CreatedDate),
                    new SqlParameter("@CreatedBy",           objML_UserType.CreatedBy),
                    new SqlParameter("@CreatedByUserNameId", objML_UserType.CreatedByUserNameId),
                    //new SqlParameter("@ModifiedDate", objML_UserType.ModifiedDate),
                    //new SqlParameter("@ModifiedBy", objML_UserType.ModifiedBy),
                    ReturnObj
                    #endregion
                };
                this.Parameters = parameters;
                SqlHelper.ExecuteNonQuery(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_SaveUserType.ToString(), this.Parameters);



                if (ReturnObj.Value != null)
                {
                    results = ML_Common.string2int32(ReturnObj.Value.ToString());
                }
            }
            catch (SqlException sqlExc)
            {
                SqlException sqlExt = sqlExc; throw;
            }
            catch (Exception ex)
            {
                results = 0;
                Exception exx = ex;
                throw;
            }
            finally
            {
                //
            }
            return(results);
        }
        public ML_CokeType GetCokeTypeByCokeTypeId(int CokeTypeId)
        {
            DataTable dt = new DataTable();

            try
            {
                objML_CokeType = new ML_CokeType();
                SqlParameter[] parameters =
                {
                    #region Get Properties
                    new SqlParameter("@CokeTypeId", CokeTypeId)
                    #endregion
                };

                this.Parameters = parameters;
                SqlDataReader sdr = SqlHelper.ExecuteReader(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCokeTypeByCokeTypeId.ToString(), this.Parameters);



                if (sdr.HasRows)
                {
                    dt.Load(sdr);
                    if (dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];
                        objML_CokeType.Id                  = ML_Common.string2int32(ML_Common.clean(dr["Id"].ToString()));
                        objML_CokeType.CokeTypeId          = ML_Common.string2int32(ML_Common.clean(dr["CokeTypeId"].ToString()));
                        objML_CokeType.CokeType            = ML_Common.clean(dr["CokeType"].ToString());
                        objML_CokeType.Remarks             = ML_Common.clean(dr["Remarks"].ToString());
                        objML_CokeType.IsActive            = ML_Common.clean(dr["IsActive"].ToString());
                        objML_CokeType.IsArchive           = ML_Common.clean(dr["IsArchive"].ToString());
                        objML_CokeType.CreatedDate         = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["CreatedDate"].ToString()));
                        objML_CokeType.CreatedBy           = ML_Common.clean(dr["CreatedBy"].ToString());
                        objML_CokeType.ModifiedDate        = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["ModifiedDate"].ToString()));
                        objML_CokeType.ModifiedBy          = ML_Common.clean(dr["ModifiedBy"].ToString());
                        objML_CokeType.CreatedByUserNameId = ML_Common.string2int(ML_Common.clean(dr["CreatedByUserNameId"].ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                throw;
            }
            finally
            {
                //LogManager.LogManager.WriteTraceLog(
            }
            return(objML_CokeType);
        }
        public ML_UserType GetUserTypeByUserType(string UserType)
        {
            DataTable dt = new DataTable();

            try
            {
                objML_UserType = new ML_UserType();
                SqlParameter[] parameters =
                {
                    #region Get Properties
                    new SqlParameter("@UserType", UserType)
                    #endregion
                };

                this.Parameters = parameters;
                SqlDataReader sdr = SqlHelper.ExecuteReader(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetUserTypeByUserType.ToString(), this.Parameters);



                if (sdr.HasRows)
                {
                    dt.Load(sdr);
                    if (dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];
                        objML_UserType.Id                  = ML_Common.string2Int32(ML_Common.clean(dr["Id"].ToString()));
                        objML_UserType.UserTypeId          = ML_Common.string2Int32(ML_Common.clean(dr["UserTypeId"].ToString()));
                        objML_UserType.UserType            = ML_Common.clean(dr["UserType"].ToString());
                        objML_UserType.IsActive            = ML_Common.clean(dr["IsActive"].ToString());
                        objML_UserType.IsArchive           = ML_Common.clean(dr["IsArchive"].ToString());
                        objML_UserType.CreatedDate         = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["CreatedDate"].ToString()));
                        objML_UserType.CreatedBy           = ML_Common.clean(dr["CreatedBy"].ToString());
                        objML_UserType.ModifiedDate        = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["ModifiedDate"].ToString()));
                        objML_UserType.ModifiedBy          = ML_Common.clean(dr["ModifiedBy"].ToString());
                        objML_UserType.CreatedByUserNameId = ML_Common.string2Int32(dr["CreatedByUserNameId"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                Exception exx = ex;
                throw;
            }
            finally
            {
                //
            }
            return(objML_UserType);
        }
 protected void grdItemCategoryMaster_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         int lngId = ML_Common.string2int(grdItemCategoryMaster.DataKeys[e.RowIndex].Values[0].ToString());
         DeleteGridRowItem(lngId);
         FillGrid();
         lblMsg.Visible = true;
         lblMsg.Text    = string.Empty;
     }
     catch (Exception ex)
     {
         Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex);
     }
 }
Exemple #21
0
        private void FillGrid()
        {
            try
            {
                DataTable DtList = null;
                if (ViewState["grdCokeSupplier"] == null)
                {
                    ML_CokeSupplier objML_CokeSupplierh = new ML_CokeSupplier();
                    objML_CokeSupplierh.CokeSupplier = ML_Common.clean(txtCokeSupplierSearch.Text);
                    objBusinessClass = new BusinessLayer.BusinessClass();
                    DtList           = objBusinessClass.GetCokeSupplierBySeacrh(objML_CokeSupplierh);


                    ViewState["grdCokeSupplier"] = DtList;
                }
                else
                {
                    DtList = (DataTable)ViewState["grdCokeSupplier"];
                }

                if (DtList != null)
                {
                    // DtList = (DataTable)ViewState["grdPitchType"];
                    if (DtList.Rows.Count > 0)
                    {
                        grdCokeSupplier.DataSource = DtList;
                        grdCokeSupplier.DataBind();
                    }
                    else
                    {
                        DtList.Rows.Add(DtList.NewRow());
                        grdCokeSupplier.DataSource = DtList;
                        grdCokeSupplier.DataBind();

                        int TotalColumns = grdCokeSupplier.Rows[0].Cells.Count;
                        grdCokeSupplier.Rows[0].Cells.Clear();
                        grdCokeSupplier.Rows[0].Cells.Add(new TableCell());
                        grdCokeSupplier.Rows[0].Cells[0].ColumnSpan = TotalColumns;
                        grdCokeSupplier.Rows[0].Cells[0].Text       = "No Record Found";
                    }
                    UpdatePanelGrid.Update();
                }
            }
            catch (Exception ex)
            {
                Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex);
            }
        }
        public ML_CanteenMaster GetCanteenMasterByCanteenActive(long CanteenActive)
        {
            try
            {
                sbTraceInformation = new StringBuilder();
                sbTraceInformation.Append("Entered:-Inside BusinessClasses-CanteenMaster:GetCanteenMasterById(long Id)");
                sbTraceInformation.Remove(0, sbTraceInformation.Length);

                objML_CanteenMaster = new ML_CanteenMaster();
                SqlParameter[] parameters =
                {
                    #region Get Properties
                    new SqlParameter("@CanteenActive", CanteenActive)
                    #endregion
                };

                this.Parameters = parameters;
                DataSet ds = SqlHelper.ExecuteDataset(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCanteenMasterByCanteenActive.ToString(), this.Parameters);

                sbTraceInformation.Append("Exit:-From BusinessClasses-CanteenMaster:GetCanteenMasterById(long Id)");
                sbTraceInformation.Remove(0, sbTraceInformation.Length);

                if (ds.Tables.Count > 0)
                {
                    DataTable dt = ds.Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];
                        objML_CanteenMaster.CanteenCode    = ML_Common.string2int32(ML_Common.clean(dr["CanteenCode"].ToString()));
                        objML_CanteenMaster.CanteenName    = ML_Common.clean(dr["CanteenName"].ToString());
                        objML_CanteenMaster.CanteenAddress = ML_Common.clean(dr["CanteenAddress"].ToString());
                        objML_CanteenMaster.CanteenActive  = ML_Common.string2int32(ML_Common.clean(dr["CanteenActive"].ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                throw;
            }
            finally
            {
                //LogManager.LogManager.WriteTraceLog(sbTraceInformation.ToString());
            }
            return(objML_CanteenMaster);
        }
Exemple #23
0
        protected void btnChangePassword_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                //errNumber = -1;
                try
                {
                    objBusinessClass = new BusinessLayer.BusinessClass();
                    objML_UserName   = new ML_UserName();



                    string UserName    = ML_Common.clean(txtUserName.Text);
                    string oldPassword = ML_Common.clean(txtOldPassword.Text);
                    string newPassword = ML_Common.clean(txtNewPassword.Text);

                    int obhReturn = objBusinessClass.UpdatePassword(UserName, oldPassword, newPassword);

                    if (obhReturn == 1)
                    {
                        lblMsg.Visible = true;
                        lblMsg.Text    = "Password changed Successfully";
                    }
                    else if (obhReturn == 2)
                    {
                        lblMsg.Text    = "User Name/Password is not Correct!";
                        lblMsg.Visible = true;
                    }
                    else
                    {
                        lblMsg.Text    = "There are some issue while Updating, Please enter correct old Password!";
                        lblMsg.Visible = true;
                    }
                }
                catch (SqlException sqlExc)
                {
                    SqlException sqlExt = sqlExc;
                    return;
                }
                catch (Exception ex)
                {
                    Exception exx = ex;
                }
            }
        }
Exemple #24
0
        public int DeleteCokeSupplierByCokeSupplierId(int CokeSupplierId)
        {
            int results = 0;

            try
            {
                SqlParameter ReturnObj = new SqlParameter("@ReturnObj", ParameterDirection.Output);
                ReturnObj.Direction = ParameterDirection.Output;
                SqlParameter[] parameters =
                {
                    #region Delete Properties
                    new SqlParameter("@CokeSupplierId", CokeSupplierId),
                    ReturnObj
                    #endregion
                };

                this.Parameters = parameters;
                SqlHelper.ExecuteNonQuery(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_DeleteCokeSupplierByCokeSupplierId.ToString(), this.Parameters);



                if (ReturnObj.Value != null)
                {
                    results = ML_Common.string2int32(ReturnObj.Value.ToString());
                }
            }
            catch (SqlException sqlExc)
            {
                SqlException sqlExt = sqlExc;
                throw;
            }
            catch (Exception ex)
            {
                results = 0;
                Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                throw;
            }
            finally
            {
                //LogManager.LogManager.WriteTraceLog(
            }
            return(results);
        }
        public int DeleteUserTypeByUserType(string UserType)
        {
            int results = 0;

            try
            {
                SqlParameter ReturnObj = new SqlParameter("@ReturnObj", ParameterDirection.Output);
                ReturnObj.Direction = ParameterDirection.Output;
                SqlParameter[] parameters =
                {
                    #region Delete Properties
                    new SqlParameter("@UserType", UserType),
                    ReturnObj
                    #endregion
                };

                this.Parameters = parameters;
                SqlHelper.ExecuteNonQuery(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_DeleteUserTypeByUserType.ToString(), this.Parameters);



                if (ReturnObj.Value != null)
                {
                    results = ML_Common.string2int32(ReturnObj.Value.ToString());
                }
            }
            catch (SqlException sqlExc)
            {
                SqlException sqlExt = sqlExc;
                throw;
            }
            catch (Exception ex)
            {
                results = 0;
                Exception exx = ex;
                throw;
            }
            finally
            {
                //
            }
            return(results);
        }
Exemple #26
0
        protected void grdUserName_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                int lngId = ML_Common.string2int32(grdUserName.DataKeys[e.RowIndex].Values[0].ToString());
                DeleteGridRowItem(lngId);

                FormFieldsClear();

                lblMsg.Visible = true;
                lblMsg.Text    = string.Empty;
                ViewState["grdUserNameEdit"] = null;
                FillGrid();
            }
            catch (Exception ex)
            {
                Exception exx = ex;
            }
        }
Exemple #27
0
 protected void grdCokeSupplier_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         // Guid  guid = ML_Common.String2Guid(grdCokeSupplier.DataKeys[e.RowIndex].Values[0].ToString());
         int lngId = ML_Common.string2int(grdCokeSupplier.DataKeys[e.RowIndex].Values[0].ToString());
         DeleteGridRowItem(lngId);
         ViewState["grdCokeSupplier"] = null;
         FillGrid();
         FormFieldsClear();
         //PanelEditFormDisplay(false);
         lblMsg.Visible = true;
         lblMsg.Text    = string.Empty;
     }
     catch (Exception ex)
     {
         Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex);
     }
 }
        protected void btnNewAdd_Click(object sender, EventArgs e)
        {
            try
            {
                ML_Common.SetDropDownValue(ddlCokeType, -1);
                ML_Common.SetDropDownValue(ddlCokeSupplier, -1);
                ML_Common.SetDropDownValue(ddlAnalysisType, -1);
                txtFieldSize.Text = string.Empty;
                txtFieldUnit.Text = string.Empty;
                txtFieldSpec.Text = string.Empty;
                txtMinValue.Text  = string.Empty;
                txtMaxValue.Text  = string.Empty;



                ViewState["dtCokeDynamic"] = null;
                dtCokeDynamic = new DataTable();
                dtCokeDynamic = BindCokeDynamicDataTable();

                dtCokeDynamic.Rows.Add(dtCokeDynamic.NewRow());
                grdCokeDynamic.DataSource = dtCokeDynamic;
                grdCokeDynamic.DataBind();

                //int TotalColumns = grdCokeComposite.Rows[0].Cells.Count;
                //grdCokeComposite.Rows[0].Cells.Clear();
                //grdCokeComposite.Rows[0].Cells.Add(new TableCell());
                //grdCokeComposite.Rows[0].Cells[0].ColumnSpan = TotalColumns;
                //grdCokeComposite.Rows[0].Cells[0].Text = "No Record Found";

                btnSubmit.Visible = false;
                btnNewAdd.Visible = false;



                UpdatePanelSave.Update();
                UpdatePanelGrid.Update();
            }
            catch (Exception ex)
            {
                Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex);
            }
        }
        protected void lnkbtnHome_Click(object sender, EventArgs e)
        {
            try
            {
                if (Session["UserTypeId"] != null)
                {
                    if (ML_Common.string2int(Session["UserTypeId"]) == 3) //Administrator
                    {
                        Response.Redirect("~/frmLabDashBoard.aspx", false);
                    }
                    else if (ML_Common.string2int(Session["UserTypeId"]) == 2) //Admin
                    {
                        Response.Redirect("~/frmDashBoard.aspx", false);
                    }
                    else if (ML_Common.string2int(Session["UserTypeId"]) == 2) //User
                    {
                        Response.Redirect("frmLabDashBoard.aspx", false);
                    }
                    else if (ML_Common.string2int(Session["UserTypeId"]) == 5) //User
                    {
                        Response.Redirect("frmCSSDashBoard.aspx", false);
                    }
                    else if (ML_Common.string2int(Session["UserTypeId"]) == 6) //User
                    {
                        Response.Redirect("frmPotDashBoard.aspx", false);
                    }

                    else
                    {
                        Response.Redirect("~/frmDashBoard.aspx", false);
                    }
                }
                else
                {
                    Response.Redirect("~/frmDashBoard.aspx", false);
                }
            }
            catch (Exception ex)
            {
                Exception ext = ex;
            }
        }
        protected void grdSanitizationReport_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                // Guid  guid = ML_Common.String2Guid(grdSanitizationReport.DataKeys[e.RowIndex].Values[0].ToString());
                long lngId = ML_Common.string2Long(grdSanitizationReport.DataKeys[e.RowIndex].Values[0].ToString());

                DeleteGridRowItem(lngId);
                ViewState["grdSanitizationReport"] = null;
                FillGrid();
                FormFieldsClear();
                //PanelEditFormDisplay(false);

                lblMsg.Text = string.Empty;
            }
            catch (Exception ex)
            {
                Exception exc = ex;
            }
        }