public ActionResult AddNewMRN(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objMRNVM_Property = new MRNVM_Property();
                Vendors_Property vendor        = new Vendors_Property();
                Product_Property product       = new Product_Property();
                Vendors_BLL      objvendorbll  = new Vendors_BLL();
                Product_BLL      objProductbll = new Product_BLL();

                //objMRNVM_Property.VendorLST = Helper.ConvertDataTable<Vendors_Property>(objvendorbll.ViewAll());
                objMRNVM_Property.ProductList   = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll());
                objMRNVM_Property.WareHouseList = Helper.ConvertDataTable <WareHouse_Property>(ViewWareHouses());
                objMRNVM_Property.mrnDate       = DateTime.Now.ToString("yyyy-MM-dd");

                if (id > 0)
                {
                    //update
                    LP_MRN_Detail_Property objmrndetail;
                    objMRNProperty     = new LP_MRN_Master_Property();
                    objMRNProperty.idx = Convert.ToInt16(id);

                    objMRNBll = new LP_MRN_BLL(objMRNProperty);
                    DataTable dt = objMRNBll.SelectById();
                    objMRNVM_Property.idx          = Convert.ToInt16(dt.Rows[0]["mrnIdx"].ToString());
                    objMRNVM_Property.description  = dt.Rows[0]["description"].ToString();
                    objMRNVM_Property.WarerHouseID = Convert.ToInt32(dt.Rows[0]["WarerHouseID"].ToString());

                    objMRNVM_Property.mrNumber = dt.Rows[0]["mrNumber"].ToString();
                    objMRNVM_Property.mrnDate  = DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //foreach(DataRow dr in dt.Rows)
                    //{
                    //    objmrndetail

                    //}
                    ViewBag.DetailData = Helper.ConvertDataTable <MRNVM_Property>(dt);

                    return(View("AddNewMRN", objMRNVM_Property));
                }
                else
                {
                    objMRNBll = new LP_MRN_BLL();
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName         = "MRN";
                    objtrans.Identityfieldname = "idx";
                    objtrans.userid            = Session["UID"].ToString();
                    objMRNVM_Property.mrNumber = objMRNBll.GenerateMRNNo(objtrans);
                    return(View("AddNewMRN", objMRNVM_Property));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
示例#2
0
        public JsonResult SelectMRById(int id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                try
                {
                    var objPurchaseProperty = new LP_MRN_Master_Property();
                    objPurchaseProperty.idx = id;

                    var objpurchaseBll = new LP_MRN_BLL(objPurchaseProperty);
                    var Data           = JsonConvert.SerializeObject(objpurchaseBll.SelectById());
                    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));
            }
        }