예제 #1
0
    //end
    protected void imgBtnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            objProductMaster.ProductSNo       = 0;
            objProductMaster.ProductCode      = txtProductCode.Text.Trim();
            objProductMaster.ProductDesc      = txtProductDesc.Text.Trim();
            objProductMaster.ProductGroup_SNo = int.Parse(ddlProductGroup.SelectedValue.ToString());
            if (ddlRating.SelectedIndex != 0)
            {
                objProductMaster.Rating_Status = ddlRating.SelectedValue.ToString();
            }
            objProductMaster.EmpCode    = Membership.GetUser().UserName.ToString();
            objProductMaster.ActiveFlag = rdoStatus.SelectedValue.ToString();
            if (ddlProducType.SelectedIndex != 0)
            {
                objProductMaster.ProductType_Sno = int.Parse(ddlProducType.SelectedValue); // Added my MUKESH 4/sep/2015
            }
            string strMsg = objProductMaster.SaveData("INSERT_PRODUCT");
            if (objProductMaster.ReturnValue == -1)
            {
                lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.ErrorInStoreProc, enuMessageType.Error, false, "");
            }
            else
            {
                if (strMsg == "Exists")
                {
                    lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.DulplicateRecord, enuMessageType.UserMessage, false, "");
                }
                else
                {
                    lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.AddRecord, enuMessageType.UserMessage, false, "");
                }
            }
        }
        catch (Exception ex)
        {
            CommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
        }
        objCommonClass.BindDataGrid(gvComm, "uspProductMaster", true, sqlParamSrh, lblRowCount);

        ClearControls();
    }