示例#1
0
 internal int InsertBillHead(HMS_BillHead objBillHead)
 {
     try
     {
         _context.HMS_BillHead.AddObject(objBillHead);
         _context.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
 internal int UpdateBillHead(HMS_BillHead objHead, int headId)
 {
     try
     {
         HMS_BillHead obj = _context.HMS_BillHead.First(x => x.HMS_Bill_Head_Id == headId);
         obj.HMS_CategoryId = objHead.HMS_CategoryId;
         obj.Bill_Head_Name = objHead.Bill_Head_Name;
         obj.Price          = objHead.Price;
         obj.Edit_User      = objHead.Edit_User;
         obj.Edit_Date      = objHead.Edit_Date;
         _context.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#3
0
        //public virtual List<HMS_BillHead> GetAllBillHead(string OCODE)
        //{
        //    return objHead_DAL.GetAllBillHead(OCODE);
        //}

        internal int UpdateBillHead(HMS_BillHead objHead, int headId)
        {
            return(objHead_DAL.UpdateBillHead(objHead, headId));
        }
示例#4
0
 internal int InsertBillHead(HMS_BillHead objBillHead)
 {
     return(objHead_DAL.InsertBillHead(objBillHead));
 }
示例#5
0
        protected void btnBillHeadSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtHead.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Bill Head !!')", true);
                }
                else if (ddlCategory.SelectedItem.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Bill Category !!')", true);
                }
                else if (txtPrice.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Price!!')", true);
                }
                else
                {
                    HMS_BillHead objHead = new HMS_BillHead();

                    objHead.OCODE          = ((SessionUser)Session["SessionUser"]).OCode;
                    objHead.Bill_Head_Name = txtHead.Text;
                    objHead.HMS_CategoryId = Convert.ToInt32(ddlCategory.SelectedValue.ToString());
                    objHead.Price          = Convert.ToDecimal(txtPrice.Text);

                    if (btnBillHeadSubmit.Text == "Submit")
                    {
                        int catId = Convert.ToInt32(objHead.HMS_CategoryId);

                        if (IsExist(objHead.Bill_Head_Name, catId))
                        {
                            objHead.Create_User = ((SessionUser)Session["SessionUser"]).UserId;
                            objHead.Create_Date = DateTime.Now;
                            int result = objHead_BLL.InsertBillHead(objHead);
                            if (result == 1)
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Save successfully!')", true);
                            }
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Already Exists!')", true);
                        }
                    }
                    else
                    {
                        if (hidHeadName.Value != txtHead.Text)
                        {
                            int catId = Convert.ToInt32(objHead.HMS_CategoryId);

                            if (IsExist(objHead.Bill_Head_Name, catId))
                            {
                                objHead.Edit_User = ((SessionUser)Session["SessionUser"]).UserId;
                                objHead.Edit_Date = DateTime.Now;

                                int headId = Convert.ToInt32(hidHeadId.Value);
                                int result = objHead_BLL.UpdateBillHead(objHead, headId);
                                if (result == 1)
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update successfully!')", true);
                                }
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Already Exists!')", true);
                            }
                        }
                        else
                        {
                            objHead.Edit_User = ((SessionUser)Session["SessionUser"]).UserId;
                            objHead.Edit_Date = DateTime.Now;

                            int headId = Convert.ToInt32(hidHeadId.Value);
                            int result = objHead_BLL.UpdateBillHead(objHead, headId);
                            if (result == 1)
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update successfully!')", true);
                            }
                        }
                    }
                    GetBillHeadInfo();
                    ClearBillHeadUi();
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }