public static bool UpdateMaterialCategory(ATTMaterialCategory objMC, Previlege pobj)
        {
            string UpdateSQL;

            UpdateSQL = "SP_EDIT_MATERIAL_CATEGORY";
            GetConnection GetConn = new GetConnection();

            try
            {
                OracleConnection DBConn = GetConn.GetDbConn(Module.LIS);

                if (Previlege.HasPrevilege(pobj, DBConn) == false)
                {
                    throw new ArgumentException(Utilities.PreviledgeMsg + " update Material Category.");
                }

                OracleParameter[] paramArray = new OracleParameter[3];
                paramArray[0] = Utilities.GetOraParam(":p_CATEGORY_ID", objMC.CategoryID, OracleDbType.Int16, ParameterDirection.Input);
                paramArray[1] = Utilities.GetOraParam(":p_CATEGORY_NAME", objMC.CategoryName, OracleDbType.Varchar2, ParameterDirection.Input);
                paramArray[2] = Utilities.GetOraParam(":p_CATEGORY_DESCRIPTION", objMC.CategoryDescription, OracleDbType.Varchar2, ParameterDirection.Input);

                SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, UpdateSQL, paramArray);

                return(true);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                GetConn.CloseDbConn();
            }
        }
Exemple #2
0
 public static bool UpdateMaterialCategory(ATTMaterialCategory objMC, Previlege pobj)
 {
     try
     {
         DLLMaterialCategory.UpdateMaterialCategory(objMC, pobj);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
        public static ObjectValidation Validate(ATTMaterialCategory objMC)
        {
            ObjectValidation OV = new ObjectValidation();

            if (objMC.CategoryName == "")
            {
                OV.IsValid      = false;
                OV.ErrorMessage = "Category Name Cannot be blank.";
                return(OV);
            }

            return(OV);
        }
Exemple #4
0
    protected void lstMaterialType_SelectedIndexChanged(object sender, EventArgs e)
    {
        List <ATTMaterialCategory> lst = (List <ATTMaterialCategory>)Session["MaterialCategoryList"];

        ATTMaterialCategory MaterialCategory = lst.Find(
            delegate(ATTMaterialCategory MC)
        {
            return(MC.CategoryID == int.Parse(this.lstCategoryName.SelectedValue));
        }
            );

        this.txtCategoryName_rqd.Text    = MaterialCategory.CategoryName;
        this.txtCategoryDescription.Text = MaterialCategory.CategoryDescription;
        lblStatus.Text = "";
    }
Exemple #5
0
        public static List <ATTMaterialCategory> GetMaterialCategory()
        {
            List <ATTMaterialCategory> MaterialCategoryLST = new List <ATTMaterialCategory>();

            foreach (DataRow row in DLLMaterialCategory.GetMaterialCategoryTable().Rows)
            {
                ATTMaterialCategory MC = new ATTMaterialCategory(int.Parse(row["CATEGORY_id"].ToString()),
                                                                 row["CATEGORY_name"].ToString(),
                                                                 "empty",
                                                                 row["DESCRIPTION"].ToString()
                                                                 );
                MaterialCategoryLST.Add(MC);
            }

            return(MaterialCategoryLST);
        }
Exemple #6
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        ATTMaterialCategory objMC;

        if (lstCategoryName.SelectedIndex == -1)
        {
            objMC = new ATTMaterialCategory(0, txtCategoryName_rqd.Text, ((ATTUserLogin)Session["Login_User_Detail"]).UserName, txtCategoryDescription.Text);
        }
        else
        {
            objMC = new ATTMaterialCategory(int.Parse(lstCategoryName.SelectedValue), txtCategoryName_rqd.Text, ((ATTUserLogin)Session["Login_User_Detail"]).UserName, txtCategoryDescription.Text);
        }


        ObjectValidation OV = BLLMaterialCategory.Validate(objMC);

        if (OV.IsValid == false)
        {
            this.lblStatus.Text = OV.ErrorMessage;
            return;
        }

        List <ATTMaterialCategory> ltMaterialCategory = (List <ATTMaterialCategory>)Session["MaterialCategoryList"];
        ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]);

        try
        {
            if (lstCategoryName.SelectedIndex == -1)
            {
                if (user.MenuList["4,2,1"] == null || user.MenuList["4,2,1"].PAdd == "N")
                {
                    this.lblStatus.Text = Utilities.PreviledgeMsg + " add Material Category.";
                    return;
                }
                Previlege pobj = new Previlege(user.UserName, "4,2,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD);


                if (BLLMaterialCategory.AddMaterialCategory(objMC, pobj))
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgressBar", "javascript:callProgressbar();", true);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ClearForm", "javascript:clearForm();", true);
                    ltMaterialCategory.Add(objMC);
                    lblStatus.Text = "New Record Added Successfully !!!";
                }
            }
            else
            {
                List <ATTMaterialCategory> lst = (List <ATTMaterialCategory>)Session["MaterialCategoryList"];

                ATTMaterialCategory MaterialCategory = lst.Find(
                    delegate(ATTMaterialCategory MC)
                {
                    return(MC.CategoryID == int.Parse(this.lstCategoryName.SelectedValue));
                }
                    );

                if ((txtCategoryName_rqd.Text == MaterialCategory.CategoryName) && (txtCategoryDescription.Text == MaterialCategory.CategoryDescription))
                {
                    lblStatus.Text = "Please Change Data to Update !!!";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgressBar", "javascript:callProgressbar();", true);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ClearForm", "javascript:clearForm();", true);
                }
                else
                {
                    if (user.MenuList["4,2,1"] == null || user.MenuList[Session["List_Menuname"].ToString()].PEdit == "N")
                    {
                        this.lblStatus.Text = Utilities.PreviledgeMsg + " update Material Category.";
                        return;
                    }
                    Previlege pobj = new Previlege(user.UserName, "4,2,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_EDIT);


                    if (BLLMaterialCategory.UpdateMaterialCategory(objMC, pobj))
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgressBar", "javascript:callProgressbar();", true);
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ClearForm", "javascript:clearForm();", true);

                        ltMaterialCategory[this.lstCategoryName.SelectedIndex] = objMC;
                        lblStatus.Text = "Existing Record Updated Successfully !!!";
                    }
                }
            }

            this.lstCategoryName.DataSource     = ltMaterialCategory;
            this.lstCategoryName.DataTextField  = "CategoryName";
            this.lstCategoryName.DataValueField = "CategoryID";
            this.lstCategoryName.DataBind();
            //this.lstCategoryName.SelectedIndex = -1;
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgressBar", "javascript:callProgressbar();", true);
            this.lblStatus.Text = ex.Message;
        }
    }