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);
            }
        }
Exemplo n.º 2
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);
            }
        }
        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;
            }
        }
Exemplo n.º 4
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;
            }
        }
        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);
            }
        }
        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);
        }
Exemplo n.º 7
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_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);
        }
Exemplo n.º 9
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 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 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_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);
        }
Exemplo n.º 13
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;
            }
        }
Exemplo n.º 14
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);
        }
 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;
     }
 }
Exemplo n.º 17
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            lblMsg.Text     = string.Empty;
            lblMsgEdit.Text = string.Empty;
            if (IsValid)
            {
                //errNumber = -1;
                try
                {
                    BusinessClass objBusinessClass = new BusinessLayer.BusinessClass();
                    int           lngId            = Convert.ToInt32(ViewState["UserNameViewId"]);
                    ML_UserName   objML_UserName   = objBusinessClass.GetUserNameById(lngId);

                    objML_UserName.UserName  = ML_Common.clean(txtUserNameEdit.Text);
                    objML_UserName.FirstName = ML_Common.clean(txtFirstNameEdit.Text);
                    objML_UserName.LastName  = ML_Common.clean(txtLastNameEdit.Text);
                    objML_UserName.Email     = ML_Common.clean(txtEmailEdit.Text);
                    objML_UserName.Telephone = ML_Common.clean(txtTelephoneEdit.Text);
                    objML_UserName.Mobile    = ML_Common.clean(txtMobileEdit.Text);
                    objML_UserName.Remarks   = ML_Common.clean(txtRemarksEdit.Text);

                    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.CreatedBy    = ML_Common.clean(string.Empty);
                    objML_UserName.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString());
                    objML_UserName.ModifiedBy   = ML_Common.clean(string.Empty);

                    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.UpdateUserName(objML_UserName);
                    if (obhReturn == 1)
                    {
                        lblMsg.Text     = "Record Update Successfully";
                        lblMsgEdit.Text = "Record Update Successfully";
                        FormFieldsClear();
                    }
                    else if (obhReturn == 2)
                    {
                        lblMsg.Text = "Record Already Exists!";


                        lblMsgEdit.Text = "Record Already Exists!";
                    }
                    else
                    {
                        lblMsg.Text = "There are some issue while Updating!";


                        lblMsgEdit.Text = "There are some issue while Updating!";
                    }
                    UpdatePanelEdit.Update();
                }
                catch (SqlException sqlExc)
                {
                    SqlException sqlExt = sqlExc;
                    return;
                }
                catch (Exception ex)
                {
                    Exception exx = 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_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);
            //    }
            //}
        }
Exemplo n.º 21
0
        public int Add(ML_CokeSupplier objML_CokeSupplier)
        {
            int results = 0;

            try
            {
                SqlParameter ReturnObj = new SqlParameter("@ReturnObj", ParameterDirection.Output);
                ReturnObj.Direction = ParameterDirection.Output;
                SqlParameter[] parameters =
                {
                    #region Add Properties
                    //new SqlParameter("@Id", objML_CokeSupplier.Id),
                    //new SqlParameter("@CokeSupplierId", objML_CokeSupplier.CokeSupplierId),
                    new SqlParameter("@CokeSupplier",        objML_CokeSupplier.CokeSupplier),
                    new SqlParameter("@Address1",            objML_CokeSupplier.Address1),
                    new SqlParameter("@Address2",            objML_CokeSupplier.Address2),
                    new SqlParameter("@Address3",            objML_CokeSupplier.Address3),
                    new SqlParameter("@CityName",            objML_CokeSupplier.CityName),
                    new SqlParameter("@StateName",           objML_CokeSupplier.StateName),
                    new SqlParameter("@PinCode",             objML_CokeSupplier.PinCode),
                    new SqlParameter("@Title",               objML_CokeSupplier.Title),
                    new SqlParameter("@CountryName",         objML_CokeSupplier.CountryName),
                    new SqlParameter("@ContactPerson",       objML_CokeSupplier.ContactPerson),
                    new SqlParameter("@MobNo",               objML_CokeSupplier.MobNo),
                    new SqlParameter("@WebSite",             objML_CokeSupplier.WebSite),
                    new SqlParameter("@Email",               objML_CokeSupplier.Email),
                    new SqlParameter("@Remarks",             objML_CokeSupplier.Remarks),
                    new SqlParameter("@IsActive",            objML_CokeSupplier.IsActive),
                    new SqlParameter("@IsArchive",           objML_CokeSupplier.IsArchive),
                    //new SqlParameter("@CreatedDate", objML_CokeSupplier.CreatedDate),
                    new SqlParameter("@CreatedBy",           objML_CokeSupplier.CreatedBy),
                    //new SqlParameter("@ModifiedDate", objML_CokeSupplier.ModifiedDate),
                    //new SqlParameter("@ModifiedBy", objML_CokeSupplier.ModifiedBy),
                    new SqlParameter("@CreatedByUserNameId", objML_CokeSupplier.CreatedByUserNameId),
                    ReturnObj
                    #endregion
                };
                this.Parameters = parameters;
                SqlHelper.ExecuteNonQuery(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_SaveCokeSupplier.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);
        }
Exemplo n.º 22
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                errNumber = -1;
                try
                {
                    objBusinessClass          = new BusinessLayer.BusinessClass();
                    objML_CategoryGroupMaster = new ML_CategoryGroupMaster();
                    string strAdminLoginName = string.Empty;
                    if (Session["AdminLoginName"] != null)
                    {
                        strAdminLoginName = Session["AdminLoginName"].ToString();
                    }



                    // objML_CategoryGroupMaster.CategoryGroupCode = ML_Common.string2int32(ML_Common.clean(txtCategoryGroupCode.Text));
                    objML_CategoryGroupMaster.CanteenCode       = ML_Common.string2int32(ML_Common.clean(txtCanteenCode.Text));
                    objML_CategoryGroupMaster.CategoryGroupName = ML_Common.clean(txtCategoryGroupName.Text);
                    // objML_CategoryGroupMaster.CategoryGroupActive = ML_Common.string2int32(ML_Common.clean(txtCategoryGroupActive.Text));


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

                    int obhReturn = objBusinessClass.AddCategoryGroupMaster(objML_CategoryGroupMaster);

                    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);
                }
            }
        }
Exemplo n.º 23
0
        public ML_CokeSupplier GetCokeSupplierByCokeSupplierId(int CokeSupplierId)
        {
            DataTable dt = new DataTable();

            try
            {
                objML_CokeSupplier = new ML_CokeSupplier();
                SqlParameter[] parameters =
                {
                    #region Get Properties
                    new SqlParameter("@CokeSupplierId", CokeSupplierId)
                    #endregion
                };

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



                if (sdr.HasRows)
                {
                    dt.Load(sdr);
                    if (dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];
                        objML_CokeSupplier.Id                  = ML_Common.string2int32(ML_Common.clean(dr["Id"].ToString()));
                        objML_CokeSupplier.CokeSupplierId      = ML_Common.string2int32(ML_Common.clean(dr["CokeSupplierId"].ToString()));
                        objML_CokeSupplier.CokeSupplier        = ML_Common.clean(dr["CokeSupplier"].ToString());
                        objML_CokeSupplier.Address1            = ML_Common.clean(dr["Address1"].ToString());
                        objML_CokeSupplier.Address2            = ML_Common.clean(dr["Address2"].ToString());
                        objML_CokeSupplier.Address3            = ML_Common.clean(dr["Address3"].ToString());
                        objML_CokeSupplier.CityName            = ML_Common.clean(dr["CityName"].ToString());
                        objML_CokeSupplier.StateName           = ML_Common.clean(dr["StateName"].ToString());
                        objML_CokeSupplier.PinCode             = ML_Common.clean(dr["PinCode"].ToString());
                        objML_CokeSupplier.Title               = ML_Common.clean(dr["Title"].ToString());
                        objML_CokeSupplier.CountryName         = ML_Common.clean(dr["CountryName"].ToString());
                        objML_CokeSupplier.ContactPerson       = ML_Common.clean(dr["ContactPerson"].ToString());
                        objML_CokeSupplier.MobNo               = ML_Common.clean(dr["MobNo"].ToString());
                        objML_CokeSupplier.WebSite             = ML_Common.clean(dr["WebSite"].ToString());
                        objML_CokeSupplier.Email               = ML_Common.clean(dr["Email"].ToString());
                        objML_CokeSupplier.Remarks             = ML_Common.clean(dr["Remarks"].ToString());
                        objML_CokeSupplier.IsActive            = ML_Common.clean(dr["IsActive"].ToString());
                        objML_CokeSupplier.IsArchive           = ML_Common.clean(dr["IsArchive"].ToString());
                        objML_CokeSupplier.CreatedDate         = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["CreatedDate"].ToString()));
                        objML_CokeSupplier.CreatedBy           = ML_Common.clean(dr["CreatedBy"].ToString());
                        objML_CokeSupplier.ModifiedDate        = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["ModifiedDate"].ToString()));
                        objML_CokeSupplier.ModifiedBy          = ML_Common.clean(dr["ModifiedBy"].ToString());
                        objML_CokeSupplier.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_CokeSupplier);
        }
        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;
                }
            }
        }