Beispiel #1
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);
                }
            }
        }