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);
            }
        }
        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;
            }
        }
Esempio n. 3
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;
            }
        }
 protected void grdSanitizationReport_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
 {
     try
     {
         lblMsg.Text = string.Empty;
         int    lngId      = ML_Common.string2int32(grdSanitizationReport.DataKeys[e.NewSelectedIndex].Values[0].ToString());
         string ReportType = ML_Common.string2string(grdSanitizationReport.DataKeys[e.NewSelectedIndex].Values[2].ToString());
         ViewState["grdSanitizationReportId"] = lngId;
         ViewState["ReportType"] = ReportType;
         if (lngId > 0)
         {
             FillObjectToForm(lngId, false);
             // ModalPopupExtenderView.Show();
         }
         else
         {
             lblMsg.Text = "Record is not exists?";
         }
     }
     catch (Exception ex)
     {
         Exception exc = ex;
     }
 }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (btnAdd.Enabled)
                {
                    DataRow dr;

                    if (ViewState["dtCokeDynamic"] == null)
                    {
                        dtCokeDynamic = new DataTable();
                        dtCokeDynamic = BindCokeDynamicDataTable();
                    }
                    else
                    {
                        dtCokeDynamic = (DataTable)ViewState["dtCokeDynamic"];
                    }



                    dr = dtCokeDynamic.NewRow();
                    dr["CokeTypeId"] = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeType, true));
                    dr["CokeType"]   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeType, false));


                    dr["CokeSupplierId"] = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplier, true));
                    dr["CokeSupplier"]   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeSupplier, false));
                    //dr["NameofParty"] = dr["CokeSupplier"];

                    dr["AnalysisTypeId"] = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlAnalysisType, true));
                    dr["AnalysisType"]   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlAnalysisType, false));
                    //dr["NameofAnalysis"] = dr["AnalysisType"];

                    //dr["SampleNo"] = dtFlowMetrDataTable.Rows.Count + 1;// ML_Common.string2int32(ML_Common.clean(txtSampleNo.Text));
                    //dr["SamplingDate"] = ML_Common.ToDateTimeSafeNull(txtSamplingDate.Text);
                    //dr["StoreSINo"] = ML_Common.string2int32(ML_Common.clean(txtStoreSINo.Text));
                    //dr["SampleDetail"] = ML_Common.clean(txtSampleDetail.Text);

                    dr["FieldSize"] = ML_Common.clean(txtFieldSize.Text);
                    dr["FieldUnit"] = ML_Common.clean(txtFieldUnit.Text);
                    dr["FieldSpec"] = ML_Common.clean(txtFieldSpec.Text);
                    dr["MinValue"]  = ML_Common.clean(txtMinValue.Text);
                    dr["MaxValue"]  = ML_Common.clean(txtMaxValue.Text);



                    dtCokeDynamic.Rows.Add(dr);

                    //DtList = (DataTable)ViewState["grdStartupBathTapping"];
                    if (dtCokeDynamic.Rows.Count > 0)
                    {
                        ViewState["dtCokeDynamic"] = dtCokeDynamic;
                        grdCokeDynamic.DataSource  = dtCokeDynamic;
                        grdCokeDynamic.DataBind();
                    }
                    else
                    {
                        dtCokeDynamic.Rows.Add(dtCokeDynamic.NewRow());
                        grdCokeDynamic.DataSource = dtCokeDynamic;
                        grdCokeDynamic.DataBind();

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


                    txtFieldSize.Text = string.Empty;
                    txtFieldUnit.Text = string.Empty;
                    txtFieldSpec.Text = string.Empty;
                    txtMinValue.Text  = string.Empty;
                    txtMaxValue.Text  = string.Empty;



                    UpdatePanelGrid.Update();
                    btnSubmit.Visible = true;

                    btnSubmit.BackColor = System.Drawing.ColorTranslator.FromHtml("#5bc0de");
                    btnSubmit.ForeColor = System.Drawing.Color.White;



                    btnNewAdd.Visible = true;
                    // btnNewAdd.BackColor = System.Drawing.Color.Green;
                    btnNewAdd.BackColor = System.Drawing.ColorTranslator.FromHtml("#5bc0de");
                    btnSubmit.ForeColor = System.Drawing.Color.White;
                    UpdatePanelSave.Update();
                }
            }
            catch (Exception ex)
            {
                string str = ex.Message.ToString();
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                //errNumber = -1;
                try
                {
                    if (btnSubmit.Enabled)
                    {
                        int obhReturn = -1;
                        objBusinessClass  = new BusinessLayer.BusinessClass();
                        objML_CokeDynamic = new ML_CokeDynamic();

                        //objML_CokeDynamic.Id = ML_Common.string2Long(ML_Common.clean(txtId.Text));
                        //objML_CokeDynamic.CokeDynamicId = ML_Common.string2Long(ML_Common.clean(txtCokeDynamicId.Text));
                        //objML_CokeDynamic.CokeDynamic = ML_Common.clean(txtCokeDynamic.Text);

                        objML_CokeDynamic.CokeTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeType, true));
                        objML_CokeDynamic.CokeType   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeType, false));

                        objML_CokeDynamic.CokeSupplierId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplier, true));
                        objML_CokeDynamic.CokeSupplier   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeSupplier, false));

                        objML_CokeDynamic.AnalysisTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlAnalysisType, true));
                        objML_CokeDynamic.AnalysisType   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlAnalysisType, false));


                        objML_CokeDynamic.FieldSize = ML_Common.clean(txtFieldSize.Text);
                        objML_CokeDynamic.FieldUnit = ML_Common.clean(txtFieldUnit.Text);
                        objML_CokeDynamic.FieldSpec = ML_Common.clean(txtFieldSpec.Text);
                        objML_CokeDynamic.MinValue  = ML_Common.clean(txtMinValue.Text);
                        objML_CokeDynamic.MaxValue  = ML_Common.clean(txtMaxValue.Text);



                        for (int i = 0; i <= grdCokeDynamic.Rows.Count - 1; i++)
                        {
                            objML_CokeDynamic.FieldSize = string.Empty;
                            objML_CokeDynamic.FieldUnit = string.Empty;
                            objML_CokeDynamic.FieldSpec = string.Empty;
                            objML_CokeDynamic.MinValue  = string.Empty;
                            objML_CokeDynamic.MaxValue  = string.Empty;


                            GridViewRow gRow          = grdCokeDynamic.Rows[i];
                            Label       lblCokeTypeID = (Label)gRow.FindControl("lblCokeTypeID");
                            if (lblCokeTypeID != null)
                            {
                                objML_CokeDynamic.CokeTypeId = ML_Common.string2int32(lblCokeTypeID.Text);
                            }
                            Label lblCokeType = (Label)gRow.FindControl("lblCokeType");
                            if (lblCokeType != null)
                            {
                                objML_CokeDynamic.CokeType = ML_Common.clean(lblCokeType.Text);
                            }



                            Label lblCokeSupplierID = (Label)gRow.FindControl("lblCokeSupplierID");
                            if (lblCokeSupplierID != null)
                            {
                                objML_CokeDynamic.CokeSupplierId = ML_Common.string2int32(lblCokeSupplierID.Text);
                            }
                            Label lblCokeSupplier = (Label)gRow.FindControl("lblCokeSupplier");
                            if (lblCokeSupplier != null)
                            {
                                objML_CokeDynamic.CokeSupplier = ML_Common.clean(lblCokeSupplier.Text);
                            }



                            Label lblAnalysisTypeID = (Label)gRow.FindControl("lblAnalysisTypeID");
                            if (lblAnalysisTypeID != null)
                            {
                                objML_CokeDynamic.AnalysisTypeId = ML_Common.string2int32(lblAnalysisTypeID.Text);
                            }
                            Label lblAnalysisType = (Label)gRow.FindControl("lblAnalysisType");
                            if (lblAnalysisTypeID != null)
                            {
                                objML_CokeDynamic.AnalysisType = ML_Common.clean(lblAnalysisType.Text);
                            }



                            Label lblFieldSize = (Label)gRow.FindControl("lblFieldSize");
                            if (lblFieldSize != null)
                            {
                                objML_CokeDynamic.FieldSize = lblFieldSize.Text;
                            }
                            Label lblFieldUnit = (Label)gRow.FindControl("lblFieldUnit");
                            if (lblFieldUnit != null)
                            {
                                objML_CokeDynamic.FieldUnit = lblFieldUnit.Text;
                            }
                            Label lblFieldSpec = (Label)gRow.FindControl("lblFieldSpec");
                            if (lblFieldSpec != null)
                            {
                                objML_CokeDynamic.FieldSpec = lblFieldSpec.Text;
                            }
                            Label lblMinValue = (Label)gRow.FindControl("lblMinValue");
                            if (lblMinValue != null)
                            {
                                objML_CokeDynamic.MinValue = lblMinValue.Text;
                            }
                            Label lblMaxValue = (Label)gRow.FindControl("lblMaxValue");
                            if (lblMaxValue != null)
                            {
                                objML_CokeDynamic.MaxValue = lblMaxValue.Text;
                            }
                            obhReturn = objBusinessClass.AddCokeDynamic(objML_CokeDynamic);
                        }

                        if (obhReturn == 1)
                        {
                            lblMsg.Text       = "Record Update Successfully";
                            lblMsgEdit.Text   = "Record Update Successfully";
                            btnSubmit.Visible = false;
                            UpdatePanelSave.Update();
                        }
                        else
                        {
                            lblMsg.Text     = "Ooops!OtherIssue...";
                            lblMsgEdit.Text = "Ooops!OtherIssue...";
                        }
                        txtFieldSize.Text = string.Empty;
                        txtFieldUnit.Text = string.Empty;
                        txtFieldSpec.Text = string.Empty;
                        txtMinValue.Text  = string.Empty;
                        txtMaxValue.Text  = string.Empty;

                        lblMsg.Text     = string.Empty;
                        lblMsgEdit.Text = string.Empty;
                        UpdatePanelSave.Update();
                        btnSubmit.Enabled = true;

                        ViewState["dtCokeDynamic"] = null;

                        dtCokeDynamic             = new DataTable();
                        dtCokeDynamic             = BindCokeDynamicDataTable();
                        grdCokeDynamic.DataSource = dtCokeDynamic;
                        grdCokeDynamic.DataBind();
                        UpdatePanelGrid.Update();

                        btnAdd.Enabled = true;
                        //btnSubmit.Visible = false;
                    }
                }

                catch (Exception ex)
                {
                    Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                }
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                //errNumber = -1;
                try
                {
                    objBusinessClass = new BusinessLayer.BusinessClass();
                    objML_UserName   = new ML_UserName();


                    objML_UserName.UserName  = ML_Common.clean(txtUserName.Text);
                    objML_UserName.FirstName = ML_Common.clean(txtFirstName.Text);
                    objML_UserName.LastName  = ML_Common.clean(txtLastName.Text);
                    objML_UserName.Email     = ML_Common.clean(txtEmail.Text);
                    objML_UserName.Telephone = ML_Common.clean(txtTelephone.Text);
                    objML_UserName.Mobile    = ML_Common.clean(txtMobile.Text);
                    objML_UserName.Password  = ML_Common.clean(txtPassword.Text);


                    objML_UserName.UserTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlUserType, true));
                    objML_UserName.UserType   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlUserType, false));

                    objML_UserName.ReTryAttempt   = 3;     // ML_Common.string2int32(ML_Common.clean(txtReTryAttempt.Text));
                    objML_UserName.IsLocked       = false; // ML_Common.string2Boolean(ML_Common.clean(txtIsLocked.Text));
                    objML_UserName.LockedDateTime = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString());
                    objML_UserName.IsActive       = ML_Common.clean(ML_Common.bit2int(true).ToString());
                    objML_UserName.IsArchive      = ML_Common.clean(ML_Common.bit2int(false).ToString());
                    objML_UserName.CreatedDate    = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString());

                    objML_UserName.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString());


                    if (Session["UserName"] != null && Session["UserNameId"] != null)
                    {
                        objML_UserName.CreatedBy           = ML_Common.clean(Session["UserName"]);
                        objML_UserName.ModifiedBy          = ML_Common.clean(Session["UserName"]);
                        objML_UserName.CreatedByUserNameId = ML_Common.string2int32(ML_Common.clean(Session["UserNameId"]));
                    }


                    int obhReturn = objBusinessClass.AddUserName(objML_UserName);

                    if (obhReturn == 1)
                    {
                        lblMsg.Visible = true;
                        lblMsg.Text    = "Record Saved Successfully";
                        FormFieldsClear();
                    }
                    else if (obhReturn == 2)
                    {
                        lblMsg.Text    = "Record Already Exists!";
                        lblMsg.Visible = true;
                    }
                }
                catch (SqlException sqlExc)
                {
                    SqlException sqlExt = sqlExc;
                    return;
                }
                catch (Exception ex)
                {
                    Exception exx = ex;
                }
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                //errNumber = -1;
                try
                {
                    objBusinessClass        = new BusinessLayer.BusinessClass();
                    objML_CokeDynamicResult = new ML_CokeDynamicResult();



                    ML_CokeDynamic objML_CokeDynamic = null;// new ML_KeysPointChk();
                    objBusinessClass = new BusinessClass();

                    int CokeDynamicId = -1;
                    int obhReturn     = 0;

                    DateTime dtDateandTime = System.DateTime.Now;
                    if (ddlCokeType.SelectedIndex > 0)
                    {
                        foreach (GridViewRow row in grdCokeDynamicResult.Rows)
                        {
                            objML_CokeDynamic = new ML_CokeDynamic();
                            string txtCokeDynamicResult = string.Empty;



                            TextBox mytxtCokeDynamicResult = (TextBox)row.FindControl("txtCokeDynamicResult");
                            if (mytxtCokeDynamicResult != null)
                            {
                                txtCokeDynamicResult = mytxtCokeDynamicResult.Text;
                            }



                            Label lblCokeDynamicId = (Label)row.FindControl("lblCokeDynamicId");
                            if (lblCokeDynamicId != null)
                            {
                                CokeDynamicId = ML_Common.string2int(lblCokeDynamicId.Text);

                                objML_CokeDynamic = objBusinessClass.GetCokeDynamicByCokeDynamicId(CokeDynamicId);

                                objML_CokeDynamicResult = new ML_CokeDynamicResult();


                                objML_CokeDynamicResult.CokeDynamicResult = objML_CokeDynamic.CokeDynamic;


                                objML_CokeDynamicResult.CokeTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeType, true));
                                objML_CokeDynamicResult.CokeType   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeType, false));

                                objML_CokeDynamicResult.CokeSupplierId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplierName, true));
                                objML_CokeDynamicResult.CokeSupplier   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeSupplierName, false));

                                objML_CokeDynamicResult.AnalysisTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlAnalysisType, true));
                                objML_CokeDynamicResult.AnalysisType   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlAnalysisType, false));

                                objML_CokeDynamicResult.CokeDynamicId = objML_CokeDynamicResult.CokeDynamicId;
                                objML_CokeDynamicResult.CokeDynamic   = objML_CokeDynamic.CokeDynamic;


                                objML_CokeDynamicResult.FieldSize = objML_CokeDynamic.FieldSize;
                                objML_CokeDynamicResult.FieldUnit = objML_CokeDynamic.FieldUnit;
                                objML_CokeDynamicResult.FieldSpec = objML_CokeDynamic.FieldSpec;
                                objML_CokeDynamicResult.MinValue  = objML_CokeDynamic.MinValue;
                                objML_CokeDynamicResult.MaxValue  = objML_CokeDynamic.MaxValue;



                                //objML_CokeDynamicResult.CokeDynamicId = ML_Common.string2string(txtCokeDynamicResult);


                                objML_CokeDynamicResult.CokeTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeType, true));
                                objML_CokeDynamicResult.CokeType   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeType, false));

                                objML_CokeDynamicResult.CokeSupplierId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplierName, true));
                                objML_CokeDynamicResult.CokeSupplier   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeSupplierName, false));


                                objML_CokeDynamicResult.AnalysisTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlAnalysisType, true));
                                objML_CokeDynamicResult.AnalysisType   = ML_Common.string2string(ML_Common.GetDropDownValue(ddlAnalysisType, false));

                                objML_CokeDynamicResult.FieldSize = ML_Common.clean(objML_CokeDynamicResult.FieldSize);


                                objML_CokeDynamicResult.FieldUnit = ML_Common.clean(objML_CokeDynamicResult.FieldUnit);
                                objML_CokeDynamicResult.FieldSpec = ML_Common.clean(objML_CokeDynamicResult.FieldSpec);
                                objML_CokeDynamicResult.MinValue  = ML_Common.clean(objML_CokeDynamicResult.MinValue);
                                objML_CokeDynamicResult.MaxValue  = ML_Common.clean(objML_CokeDynamicResult.MaxValue);


                                obhReturn = objBusinessClass.AddCokeDynamicResult(objML_CokeDynamicResult);
                            }
                        }
                        if (obhReturn == 1)
                        {
                            lblMsg.Visible = true;
                            lblMsg.Text    = "Record Saved Successfully";
                        }

                        FormFieldsClear();
                    }
                }

                catch (SqlException sqlExc)
                {
                    SqlException sqlExt = sqlExc;
                    return;
                }
                catch (Exception ex)
                {
                    Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                }
            }



            //if (IsValid )
            //{
            //    //errNumber = -1;
            //    try
            //    {
            //        objBusinessClass = new BusinessLayer.BusinessClass();
            //        objML_CokeDynamicResult = new ML_CokeDynamicResult();
            //        string strAdminLoginName = string.Empty;
            //        if (Session["UserName"] != null)
            //        {
            //            strAdminLoginName = Session["UserName"].ToString();
            //        }



            //        objML_CokeDynamicResult.Id = ML_Common.string2Long(ML_Common.clean(txtId.Text));
            //        objML_CokeDynamicResult.CokeDynamicResultId = ML_Common.string2Long(ML_Common.clean(txtCokeDynamicResultId.Text));
            //        objML_CokeDynamicResult.CokeDynamicResult = ML_Common.clean(txtCokeDynamicResult.Text);
            //        objML_CokeDynamicResult.CokeDynamicId = ML_Common.string2int32(ML_Common.clean(txtCokeDynamicId.Text));
            //        objML_CokeDynamicResult.CokeDynamic = ML_Common.clean(txtCokeDynamic.Text);
            //        objML_CokeDynamicResult.CPCokeId = ML_Common.string2int32(ML_Common.clean(txtCPCokeId.Text));
            //        objML_CokeDynamicResult.CPCokeName = ML_Common.clean(txtCPCokeName.Text);
            //        objML_CokeDynamicResult.CokeTypeId = ML_Common.string2int32(ML_Common.clean(txtCokeTypeId.Text));
            //        objML_CokeDynamicResult.CokeType = ML_Common.clean(txtCokeType.Text);
            //        objML_CokeDynamicResult.CokeSupplierId = ML_Common.string2int32(ML_Common.clean(txtCokeSupplierId.Text));
            //        objML_CokeDynamicResult.CokeSupplier = ML_Common.clean(txtCokeSupplier.Text);
            //        objML_CokeDynamicResult.AnalysisTypeId = ML_Common.string2int32(ML_Common.clean(txtAnalysisTypeId.Text));
            //        objML_CokeDynamicResult.AnalysisType = ML_Common.clean(txtAnalysisType.Text);
            //        objML_CokeDynamicResult.FieldSize = ML_Common.clean(txtFieldSize.Text);
            //        objML_CokeDynamicResult.FieldUnit = ML_Common.clean(txtFieldUnit.Text);
            //        objML_CokeDynamicResult.FieldSpec = ML_Common.clean(txtFieldSpec.Text);
            //        objML_CokeDynamicResult.MinValue = ML_Common.clean(txtMinValue.Text);
            //        objML_CokeDynamicResult.MaxValue = ML_Common.clean(txtMaxValue.Text);


            //        // objML_CokeDynamicResult.IsActive = ML_Common.clean(ML_Common.bit2int(chkIsActive.Checked).ToString());
            //        // objML_CokeDynamicResult.IsArchive = ML_Common.clean(ML_Common.bit2int(chkIsArchive.Checked).ToString());
            //        // objML_CokeDynamicResult.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString());
            //        // objML_CokeDynamicResult.CreatedBy = ML_Common.clean(string.Empty);
            //        // objML_CokeDynamicResult.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString());
            //        // objML_CokeDynamicResult.ModifiedBy = ML_Common.clean(string.Empty);

            //        int obhReturn = objBusinessClass.AddCokeDynamicResult(objML_CokeDynamicResult);

            //        if (obhReturn == 1)
            //        {
            //            lblMsg.Visible = true;
            //            lblMsg.Text = "Record Saved Successfully";
            //        }
            //        else if (obhReturn == 2)
            //        {
            //            lblMsg.Text = "Record Already Exists!";
            //            lblMsg.Visible = true;
            //        }
            //    }
            //    catch (SqlException sqlExc)
            //    {
            //        // LogManager.LogManager.WriteErrorLog(sqlExc);
            //        foreach (SqlError error in sqlExc.Errors)
            //        {
            //            errNumber = error.Number;
            //        }
            //        if (errNumber == 50000)
            //        {
            //        }
            //        return;
            //    }
            //    catch (Exception ex)
            //    {
            //        Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
            //    }
            //}
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                //errNumber = -1;
                try
                {
                    objBusinessClass   = new BusinessLayer.BusinessClass();
                    objML_CokeSupplier = new ML_CokeSupplier();

                    objML_CokeSupplier.CokeSupplier  = ML_Common.string2string(txtCokeSupplier.Text);
                    objML_CokeSupplier.Address1      = ML_Common.clean(txtAddress1.Text);
                    objML_CokeSupplier.Address2      = ML_Common.clean(txtAddress2.Text);
                    objML_CokeSupplier.Address3      = ML_Common.clean(txtAddress3.Text);
                    objML_CokeSupplier.CityName      = string.Empty; // ML_Common.clean(txtCityName.Text);
                    objML_CokeSupplier.StateName     = string.Empty; // ML_Common.clean(txtStateName.Text);
                    objML_CokeSupplier.PinCode       = string.Empty; // ML_Common.clean(txtPinCode.Text);
                    objML_CokeSupplier.Title         = string.Empty; //ML_Common.clean(txtTitle.Text);
                    objML_CokeSupplier.CountryName   = string.Empty; //ML_Common.clean(txtCountryName.Text);
                    objML_CokeSupplier.ContactPerson = ML_Common.clean(txtContactPerson.Text);
                    objML_CokeSupplier.MobNo         = ML_Common.clean(txtMobNo.Text);
                    objML_CokeSupplier.WebSite       = string.Empty;// ML_Common.clean(txtWebSite.Text);
                    objML_CokeSupplier.Email         = ML_Common.clean(txtEmail.Text);
                    objML_CokeSupplier.Remarks       = ML_Common.clean(txtRemarks.Text);


                    objML_CokeSupplier.IsActive            = ML_Common.clean(ML_Common.bit2int(true).ToString());
                    objML_CokeSupplier.IsArchive           = ML_Common.clean(ML_Common.bit2int(false).ToString());
                    objML_CokeSupplier.CreatedDate         = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString());
                    objML_CokeSupplier.CreatedBy           = ML_Common.clean(string.Empty);
                    objML_CokeSupplier.ModifiedDate        = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString());
                    objML_CokeSupplier.ModifiedBy          = ML_Common.clean(string.Empty);
                    objML_CokeSupplier.CreatedByUserNameId = 1;// ML_Common.string2int(ML_Common.clean(txtCreatedByUserNameId.Text));



                    int obhReturn = objBusinessClass.AddCokeSupplier(objML_CokeSupplier);

                    if (obhReturn == 1)
                    {
                        lblMsg.Text = "Record Saved Successfully";
                        FormFieldsClear();
                    }
                    else
                    {
                        lblMsg.Text = "Record Already Exists!";
                        FormFieldsClear();
                    }
                }
                catch (SqlException sqlExc)
                {
                    lblMsg.Text = "Record Already Exists!";
                    SqlException sqlExt = sqlExc;
                    return;
                }
                catch (Exception ex)
                {
                    Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                }
            }
        }
Esempio n. 10
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            lblMsg.Text     = string.Empty;
            lblMsgEdit.Text = string.Empty;

            if (IsValid)
            {
                //errNumber = -1;
                BusinessClass   objBusinessClass   = new BusinessLayer.BusinessClass();
                int             lngId              = Convert.ToInt32(ViewState["grdCokeSupplierId"]);
                ML_CokeSupplier objML_CokeSupplier = objBusinessClass.GetCokeSupplierById(lngId);
                try
                {
                    if (objML_CokeSupplier != null)
                    {
                        //  objML_CokeSupplier.Id = ML_Common.string2int32(ML_Common.clean(txtIdEdit.Text));

                        // objML_CokeSupplier.CokeSupplierId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplierEdit, true));
                        objML_CokeSupplier.CokeSupplier  = ML_Common.string2string(txtCokeSupplierEdit.Text);
                        objML_CokeSupplier.Address1      = ML_Common.clean(txtAddress1Edit.Text);
                        objML_CokeSupplier.Address2      = ML_Common.clean(txtAddress2Edit.Text);
                        objML_CokeSupplier.Address3      = ML_Common.clean(txtAddress3Edit.Text);
                        objML_CokeSupplier.CityName      = string.Empty; //ML_Common.clean(txtCityNameEdit.Text);
                        objML_CokeSupplier.StateName     = string.Empty; // ML_Common.clean(txtStateNameEdit.Text);
                        objML_CokeSupplier.PinCode       = string.Empty; //ML_Common.clean(txtPinCodeEdit.Text);
                        objML_CokeSupplier.Title         = string.Empty; // ML_Common.clean(txtTitleEdit.Text);
                        objML_CokeSupplier.CountryName   = string.Empty; // ML_Common.clean(txtCountryNameEdit.Text);
                        objML_CokeSupplier.ContactPerson = ML_Common.clean(txtContactPersonEdit.Text);
                        objML_CokeSupplier.MobNo         = ML_Common.clean(txtMobNoEdit.Text);
                        objML_CokeSupplier.WebSite       = string.Empty;// ML_Common.clean(txtWebSiteEdit.Text);
                        objML_CokeSupplier.Email         = ML_Common.clean(txtEmailEdit.Text);
                        objML_CokeSupplier.Remarks       = ML_Common.clean(txtRemarksEdit.Text);


                        objML_CokeSupplier.IsActive            = ML_Common.clean(ML_Common.bit2int(true).ToString());
                        objML_CokeSupplier.IsArchive           = ML_Common.clean(ML_Common.bit2int(false).ToString());
                        objML_CokeSupplier.CreatedDate         = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString());
                        objML_CokeSupplier.CreatedBy           = ML_Common.clean(string.Empty);
                        objML_CokeSupplier.ModifiedDate        = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString());
                        objML_CokeSupplier.ModifiedBy          = ML_Common.clean(string.Empty);
                        objML_CokeSupplier.CreatedByUserNameId = 1;// ML_Common.string2int(ML_Common.clean(txtCreatedByUserNameIdEdit.Text));

                        //  int obhReturn = objBusinessClass.UpdateUniqueCokeSupplier(objML_CokeSupplier);
                        int obhReturn = objBusinessClass.UpdateCokeSupplier(objML_CokeSupplier);
                        if (obhReturn == 1)
                        {
                            lblMsg.Visible  = true;
                            lblMsg.Text     = "Record Update Successfully";
                            lblMsgEdit.Text = "Record Update Successfully";
                            ModalPopupExtenderEdit.Hide();
                            lblMsgEdit.Text = string.Empty;
                        }
                        else if (obhReturn == 2)
                        {
                            lblMsg.Text     = "Record Already Exists!";
                            lblMsgEdit.Text = "Record Already Exists!";
                            lblMsg.Visible  = true;
                            ModalPopupExtenderEdit.Hide();
                        }
                        else
                        {
                            lblMsg.Text     = "Ooops!OtherIssue...";
                            lblMsgEdit.Text = "Ooops!OtherIssue...";
                            lblMsg.Visible  = true;
                        }
                        FillGrid();
                    }
                }
                catch (SqlException sqlExc)
                {
                    SqlException sqlExt = sqlExc;
                    return;
                }
                catch (Exception ex)
                {
                    Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex);
                }
            }
        }