Esempio n. 1
0
        private void LoadShopCategory()
        {
            List<ShopCategory> shopCategories = new ShopCategory().GetAllShopCategory();
            shopCategories.Insert(0,new ShopCategory());

            ddlShopType.DataTextField = "Category";
            ddlShopType.DataValueField = "Id";

            ddlShopType.DataSource = shopCategories;
            ddlShopType.DataBind();

            ddlShopType.SelectedIndex = 0;
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {

                if (txtCategory.Text==string.Empty)
                {
                    lblMessage.Text = "দয়া করে দোকানের বিভাগ প্রদান করুন।";
                    lblMessage.ForeColor = Color.Red;
                    txtCategory.Focus();
                    return;
                }
                if (txtServiceCharge.Text == string.Empty)
                {
                    lblMessage.Text = "দয়া করে দোকানের সার্ভিস চার্জ করুন।";
                    lblMessage.ForeColor = Color.Red;
                    txtServiceCharge.Focus();
                    return;
                }
                string strServcieCharge = Encode.HtmlEncode(txtServiceCharge.Text);
                decimal decServiceCharge = 0;
                try
                {
                    decServiceCharge = decimal.Parse(strServcieCharge);
                }
                catch (Exception ex)
                {
                    lblMessage.Text = "দয়া করে সার্ভিস চার্জ ফিল্ডে শুধুমাত্র নাম্বার প্রবেশ করুন।";
                    lblMessage.ForeColor = Color.Red;
                    txtServiceCharge.Focus();
                    return;
                }

                string strMiscBill = Encode.HtmlEncode(txtMiscBill.Text);
                decimal decMiscBill = 0;
                try
                {
                    decMiscBill = decimal.Parse(strMiscBill);
                }
                catch (Exception ex)
                {
                    lblMessage.Text = "দয়া করে বিবিধ বিল ফিল্ডে শুধুমাত্র নাম্বার প্রবেশ করুন।";
                    lblMessage.ForeColor = Color.Red;
                    txtMiscBill.Focus();
                    return;
                }

                ShopCategory obj = new ShopCategory();

                obj.Category = txtCategory.Text;
                obj.ServiceCharge = decServiceCharge;
                obj.MiscBill = decMiscBill;
                obj.Description= txtDescription.Text;
                obj.IsActive = true;
                obj.LastModified = DateTime.Now;
                obj.ModifiedBy = userId;

                int success = 0;

                if(isNewEntry)
                    success = obj.InsertShopCategory();
                else
                {
                    obj.Id = int.Parse(lblId.Text);
                    success = obj.UpdateShopCategory();
                }

                if (success == 1)
                {
                    Alert.Show("তথ্য সংরক্ষণ হয়েছে।");

                    this.clear();
                    this.LoadGrid();
                    txtCategory.Focus();
                }
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }
        }
Esempio n. 3
0
        protected void ddlShopType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ddlShopType.SelectedIndex > 0)
            {
                int categoryId = int.Parse(ddlShopType.SelectedValue);

                ShopCategory shopCategory = new ShopCategory().GetShopCategoryById(categoryId);
                if (shopCategory.Id != 0)
                    txtServiceCharge.Text = shopCategory.ServiceCharge.ToString();
                else
                    txtServiceCharge.Text = "";
            }
        }
        private void LoadGrid()
        {
            try
            {
                List<ShopCategory> shopCategories = new ShopCategory().GetAllShopCategory();

                RadGrid1.DataSource = shopCategories;
                RadGrid1.DataBind();
            }
            catch (Exception ex)
            {
                Alert.Show("Error in method 'LoadLeaveDetailsGrid'. Error: " + ex.Message);
            }
        }