protected void CatagoryBtn_Click(object sender, EventArgs e)
        {
            string catName   = CatagoryTxt.Text;
            string catDesc   = catDescTxt.InnerText.ToString();
            bool   catStatus = catStatusCb.Checked;

            BusinessEntitiesBS.Catagory_Entities.catagoryObj catObj = new BusinessEntitiesBS.Catagory_Entities.catagoryObj();

            catObj.catagoryName   = catName;
            catObj.catagoryDesc   = catDesc;
            catObj.catagoryStatus = catStatus;

            try
            {
                IAdmin catInsert = new AdminItems();

                int insertCatChk = catInsert.insertCatagory(catObj);

                if (insertCatChk != -1)
                {
                    string NewDir = Server.MapPath("~/ItemImages/" + insertCatChk);
                    try
                    {
                        // Check if directory exists
                        if (!Directory.Exists(NewDir))
                        {
                            // Create the directory.
                            Directory.CreateDirectory(NewDir);
                            catMsgLbl.Text = HardCodedValues.BuddaResource.CatogoryAdd;
                            getcatgs();
                        }
                    }
                    catch (IOException _ex)
                    {
                        catMsgLbl.Text = HardCodedValues.BuddaResource.FloderError + _ex.Message;
                    }
                }
                else
                {
                    catMsgLbl.Text      = HardCodedValues.BuddaResource.CatogoryNotAdded;
                    catMsgLbl.ForeColor = System.Drawing.Color.Red;
                }
                ClearCache();
            }
            catch (Exception exp)
            {
                //throw exp;
                catMsgLbl.Text      = HardCodedValues.BuddaResource.ConnectionError + exp.Message;
                catMsgLbl.ForeColor = System.Drawing.Color.Red;
            }
        }
Esempio n. 2
0
        protected void CatagoryBtn_Click(object sender, EventArgs e)
        {
            string catName   = CatagoryTxt.Text;
            string catDesc   = catDescTxt.InnerText.ToString();
            bool   catStatus = catStatusCb.Checked;



            BusinessEntitiesBS.Catagory_Entities.catagoryObj catObj = new BusinessEntitiesBS.Catagory_Entities.catagoryObj();

            catObj.catagoryName   = catName;
            catObj.catagoryDesc   = catDesc;
            catObj.catagoryStatus = catStatus;

            try
            {
                IAdmin catInsert = new AdminItems();

                int insertCatChk = catInsert.insertCatagory(catObj);
                if (insertCatChk != -1)
                {
                    string NewDir = Server.MapPath("~/ItemImages/" + insertCatChk);
                    try
                    {
                        // Check if directory exists
                        if (!Directory.Exists(NewDir))
                        {
                            // Create the directory.
                            Directory.CreateDirectory(NewDir);
                            catMsgLbl.Text = "Catagory inserted";
                        }
                    }
                    catch (IOException _ex)
                    {
                        catMsgLbl.Text = "Error: Floder" + _ex.Message;
                    }
                }
                else
                {
                    catMsgLbl.Text      = "Catagory not inserted";
                    catMsgLbl.ForeColor = System.Drawing.Color.Red;
                }
            }
            catch (Exception exp)
            {
                //throw exp;
                catMsgLbl.Text      = "Unable to connect" + exp.Message;
                catMsgLbl.ForeColor = System.Drawing.Color.Red;
            }
        }