protected void lnkuomsave_Click(object sender, EventArgs e)
        {
            Int32        empIdno         = Convert.ToInt32((Session["UserIdno"] == null) ? "0" : Session["UserIdno"].ToString());
            string       strMsg          = string.Empty;
            UOMMasterDAL objclsUOMMaster = new UOMMasterDAL();
            Int64        intUOMIdno      = 0;

            if (txtUOMNameu.Text != "")
            {
                intUOMIdno = objclsUOMMaster.Insert(txtUOMNameu.Text.Trim(), txtNameHindiu.Text.Trim(), txtDescriptionu.Text.Trim(), Convert.ToBoolean(chkStatusu.Checked), empIdno);
            }
            objclsUOMMaster = null;

            if (intUOMIdno > 0)
            {
                strMsg = "Record saved successfully.";
                ClearUOM();
                BindItemUnit();
                ddlItemUnit.SelectedValue = Convert.ToString(intUOMIdno);
                ddlItemUnit.Focus();
            }
            else if (intUOMIdno < 0)
            {
                strMsg = "Record already exists.";
            }
            else
            {
                strMsg = "Record not saved.";
            }
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
        }
Esempio n. 2
0
        protected void lnkbtnUom_OnClick(object sender, EventArgs e)
        {
            Int32        empIdno         = Convert.ToInt32((Session["UserIdno"] == null) ? "0" : Session["UserIdno"].ToString());
            string       strMsg          = string.Empty;
            UOMMasterDAL objclsUOMMaster = new UOMMasterDAL();
            Int64        intUOMIdno      = 0;

            intUOMIdno = objclsUOMMaster.Insert(txtUOMName.Text.Trim(), "", "", true, empIdno);

            objclsUOMMaster = null;

            if (intUOMIdno > 0)
            {
                txtUOMName.Text = string.Empty;
                BindItemUnit();
                strMsg = "Record saved successfully.";
            }
            else if (intUOMIdno < 0)
            {
                strMsg = "Record already exists.";
            }
            else
            {
                strMsg = "Record not saved.";
            }
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
        }
        protected void lnkbtnSave_OnClick(object sender, EventArgs e)
        {
            Int32        empIdno         = Convert.ToInt32((Session["UserIdno"] == null) ? "0" : Session["UserIdno"].ToString());
            string       strMsg          = string.Empty;
            UOMMasterDAL objclsUOMMaster = new UOMMasterDAL();
            Int64        intUOMIdno      = 0;

            if (string.IsNullOrEmpty(hiduomidno.Value) == true)
            {
                intUOMIdno = objclsUOMMaster.Insert(txtUOMName.Text.Trim(), txtNameHindi.Text.Trim(), txtDescription.Text.Trim(), Convert.ToBoolean(chkStatus.Checked), empIdno);
            }
            else
            {
                intUOMIdno = objclsUOMMaster.Update(txtUOMName.Text.Trim(), txtNameHindi.Text.Trim(), txtDescription.Text.Trim(), Convert.ToBoolean(chkStatus.Checked), Convert.ToInt32(hiduomidno.Value), empIdno);
            }
            objclsUOMMaster = null;

            if (intUOMIdno > 0)
            {
                if (string.IsNullOrEmpty(hiduomidno.Value) == false)
                {
                    ShowMessage("Record updated successfully.");
                }
                else
                {
                    ShowMessage("Record saved successfully.");
                }
                this.ClearControls();
                lnkbtnNew.Visible = false;
            }
            else if (intUOMIdno < 0)
            {
                ShowMessageErr("Record already exists.");
            }
            else
            {
                if (string.IsNullOrEmpty(hiduomidno.Value) == false)
                {
                    ShowMessageErr("Record not updated.");
                }
                else
                {
                    ShowMessageErr("Record not saved.");
                }
            }
            txtUOMName.Focus();
        }