Example #1
0
        public ActionResult AddNewGRN(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objGRNVM_Property        = new LP_GRN_ViewModel();
                objpurchaseBll           = new LP_Purchase_BLL();
                objGRNBll                = new LP_GRN_BLL();
                objGRNVM_Property.POList = Helper.ConvertDataTable <LP_Purchase_Master_Property>(objpurchaseBll.SelectAll());
                //objGRNVM_Property.Doc_No = "GRN-001";
                if (id > 0)
                {
                    //update
                    LP_GRN_Detail_Property objdetail;
                    objGRNProperty    = new LP_GRN_Master_Property();
                    objGRNProperty.ID = Convert.ToInt16(id);

                    objGRNBll = new LP_GRN_BLL(objGRNProperty);
                    DataTable dt = objGRNBll.SelectOne();
                    objGRNVM_Property.ID = Convert.ToInt16(dt.Rows[0]["ID"].ToString());
                    //objGRNVM_Property.vendorIdx = Convert.ToInt16(dt.Rows[0]["vendorIdx"].ToString());

                    objGRNVM_Property.Doc_No       = dt.Rows[0]["Doc_No"].ToString();
                    objGRNVM_Property.Narration    = dt.Rows[0]["Narration"].ToString();
                    objGRNVM_Property.Parent_DocID = Convert.ToInt16(dt.Rows[0]["Parent_DocID"].ToString());
                    objGRNVM_Property.Total_Amount = Convert.ToDecimal(dt.Rows[0]["Total_Amount"].ToString());
                    //objPurchaseVM_Property.purchaseDate = DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //foreach(DataRow dr in dt.Rows)
                    //{
                    //    objmrndetail

                    //}
                    ViewBag.DetailData = Helper.ConvertDataTable <LP_GRN_ViewModel>(dt);
                    //update
                    return(View("_AddNewGRN", objGRNVM_Property));
                }
                else
                {
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName         = "GRN_Master";
                    objtrans.Identityfieldname = "ID";
                    objtrans.userid            = Session["UID"].ToString();
                    objGRNVM_Property.Doc_No   = objGRNBll.GenerateMRNNo(objtrans);
                    return(View("_AddNewGRN", objGRNVM_Property));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Example #2
0
        public ActionResult AddNewGRN(int?id)
        {
            string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
            string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            string pagename       = @"/" + controllerName + @"/" + actionName;
            var    page           = (List <LP_Pages_Property>)Session["PageList"];

            if (Session["LoggedIn"] != null && Helper.CheckPageAccess(pagename, page) && Session["ISADMIN"] != null && Convert.ToBoolean(Session["ISADMIN"].ToString()) == true)
            {
                objGRNVM_Property        = new LP_GRN_ViewModel();
                objpurchaseBll           = new LP_Purchase_BLL();
                objGRNBll                = new LP_GRN_BLL();
                objGRNVM_Property.POList = Helper.ConvertDataTable <LP_Purchase_Master_Property>(objpurchaseBll.SelectAll());
                //objGRNVM_Property.Doc_No = "GRN-001";
                if (id > 0)
                {
                    //update
                    LP_GRN_Detail_Property objdetail;
                    objGRNProperty    = new LP_GRN_Master_Property();
                    objGRNProperty.ID = Convert.ToInt16(id);

                    objGRNBll = new LP_GRN_BLL(objGRNProperty);
                    DataTable dt = objGRNBll.SelectOne();
                    objGRNVM_Property.ID = Convert.ToInt16(dt.Rows[0]["ID"].ToString());
                    //objGRNVM_Property.vendorIdx = Convert.ToInt16(dt.Rows[0]["vendorIdx"].ToString());

                    objGRNVM_Property.Doc_No       = dt.Rows[0]["Doc_No"].ToString();
                    objGRNVM_Property.Narration    = dt.Rows[0]["Narration"].ToString();
                    objGRNVM_Property.Parent_DocID = Convert.ToInt16(dt.Rows[0]["Parent_DocID"].ToString());
                    objGRNVM_Property.Total_Amount = Convert.ToDecimal(dt.Rows[0]["Total_Amount"].ToString());
                    //objPurchaseVM_Property.purchaseDate = DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //foreach(DataRow dr in dt.Rows)
                    //{
                    //    objmrndetail

                    //}
                    ViewBag.DetailData = Helper.ConvertDataTable <LP_GRN_ViewModel>(dt);
                    //update
                    return(View("_AddNewGRN", objGRNVM_Property));
                }
                else
                {
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName         = "GRN_Master";
                    objtrans.Identityfieldname = "ID";
                    objtrans.userid            = Session["UID"].ToString();
                    objGRNVM_Property.Doc_No   = objGRNBll.GenerateMRNNo(objtrans);
                    return(View("_AddNewGRN", objGRNVM_Property));
                }
            }
            else
            {
                if (Session["LoggedIn"] == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }
                else
                {
                    return(RedirectToAction("NotAuthorized", "Account"));
                }
            }
        }