Exemple #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"));
            }
        }
Exemple #2
0
        public JsonResult SelectGRNById(int id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                try
                {
                    LP_GRN_Master_Property objPurchaseProperty = new LP_GRN_Master_Property();
                    objPurchaseProperty.ID = id;

                    objGRNBLL = new LP_GRN_BLL(objPurchaseProperty);
                    var Data = JsonConvert.SerializeObject(objGRNBLL.SelectOne());
                    return(Json(new { data = Data, success = true, statuscode = 200, count = Data.Length }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { data = "Session Expired", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #3
0
 public JsonResult ProcessGRN(int id)
 {
     if (Session["LOGGEDIN"] != null)
     {
         bool flag = false;
         try
         {
             objGRNProperty            = new LP_GRN_Master_Property();
             objGRNProperty.ID         = id;
             objGRNBll                 = new LP_GRN_BLL(objGRNProperty);
             objGRNProperty.DetailData = objGRNBll.SelectOne();
             flag = objGRNBll.ProcessGRN();
             return(Json(new { data = "", success = flag, msg = flag == true ? "Successfull" : "Failed", statuscode = flag == true ? 200 : 401 }, JsonRequestBehavior.AllowGet));
         }
         catch (Exception ex)
         {
             return(Json(new { data = "", success = flag, msg = flag == true ? "Successfull" : "Failed", statuscode = flag == true ? 200 : 401 }, JsonRequestBehavior.AllowGet));
         }
     }
     else
     {
         return(Json(new { data = "Session Expired", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #4
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"));
                }
            }
        }