Example #1
0
        protected void grdCanteenMaster_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("ADD"))
            {
                TextBox txtNewCanteenTypeName = (TextBox)grdCanteenMaster.FooterRow.FindControl("txtNewCanteenTypeName");

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

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

                        int obhReturn = objBusinessClass.AddCokeType(objML_CokeType);

                        if (obhReturn == 1)
                        {
                            lblMsg.Visible = true;
                            lblMsg.Text    = "Record Saved Successfully";
                            FillGrid();
                        }
                        else if (obhReturn == 2)
                        {
                            lblMsg.Text    = "Record Already Exists!";
                            lblMsg.Visible = true;
                        }
                    }
                    catch (SqlException sqlExc)
                    {
                        // LogManager.LogManager.WriteErrorLog(sqlExc);
                        SqlException sqlEt = sqlExc;
                        return;
                    }
                    catch (Exception ex)
                    {
                        Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                    }
                }
            }
        }
        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;
                }
            }
        }
Example #3
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 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);
                }
            }
        }
Example #5
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);
                }
            }
        }