예제 #1
0
 /// <summary>
 /// 根据部门id查单据
 /// </summary>
 /// <param name="departmentid"></param>
 /// <returns></returns>
 public ActionResult GetDateByDepartmentId(string departmentid, int billtype)
 {
     if (!String.IsNullOrEmpty(departmentid) && !String.IsNullOrEmpty(billtype.ToString()))
     {
         CostUnitList CostUnitListList = CostUnitListService.LoadEntities(a => a.DepartmentId == departmentid && a.BillType == billtype).FirstOrDefault();
         if (CostUnitListList == null)
         {
             return(Json(new CostUnitList()));
         }
         return(Json(CostUnitListList));
     }
     return(Json(new CostUnitList()));
 }
예제 #2
0
        //保存表单数据
        public ActionResult SaveData(CostUnitList CostUnitList)
        {
            if (Session["billType"] == null)//是否有单据类型
            {
                return(Content("没有单据类型!"));
            }
            int billtype = Convert.ToInt32(Session["billType"].ToString().Trim());

            //参数对象可以对应接受数据
            CostUnitList.MakePerson = Session["UserName"].ToString();             //保存制单人
            string result = CostUnitListService.SaveData(CostUnitList, billtype); //保存数据

            return(Content(result.ToString()));
        }
예제 #3
0
        //获取表单数据
        public ActionResult GetData()
        {
            if (Session["billType"] == null)//是否有单据类型
            {
                return(Content("没有单据类型!"));
            }
            string str = Request.Params["CostUnitListId"];//单号

            //如果新单据 没有数据
            if (string.IsNullOrEmpty(str))
            {
                return(Json(new CostUnitList()));//返回一个新建的空对象
            }
            int billtype = Convert.ToInt32(Session["billType"].ToString().Trim());
            //如果有数据
            Guid         CostUnitListId = new Guid(Request["CostUnitListId"]);                                                                      //单据编号
            CostUnitList bill           = CostUnitListService.LoadEntities(t => t.Id == CostUnitListId && t.BillType == billtype).FirstOrDefault(); //获取表单

            return(Json(bill));
        }