Esempio n. 1
0
 public JsonResult writeScore(int ID, int Score, string CurUser)
 {
     using (TransactionScope sc = new TransactionScope())
     {
         try
         {
             T_MeetShareRecord flagRecord = db.T_MeetShareRecord.FirstOrDefault(a => a.Pid == ID && a.Name == CurUser);
             if (flagRecord != null)
             {
                 return(Json(new { State = "Faile", Message = "你投过票了!" }));
             }
             T_MeetShare mod = db.T_MeetShare.Find(ID);
             if (mod.IsEnd == 1)
             {
                 return(Json(new { State = "Faile", Message = "投票结束了!" }));
             }
             mod.Score += Score;
             mod.Total++;
             db.SaveChanges();
             T_MeetShareRecord modRecord = new T_MeetShareRecord();
             modRecord.Pid   = ID;
             modRecord.Score = Score;
             modRecord.Name  = CurUser;
             db.T_MeetShareRecord.Add(modRecord);
             db.SaveChanges();
             sc.Complete();
             return(Json(new { State = "Success", Message = "投票成功" }));
         }
         catch (Exception ex)
         {
             return(Json(new { State = "Faile", Message = ex.Message }));
         }
     }
 }
 public JsonResult InterceptLogisticsSave(T_InterceptLogistics model)//创建物流订单拦截
 {
     try
     {
         var Order = db.T_InterceptLogistics.SingleOrDefault(a => a.OrderNumber == model.OrderNumber && a.Del == 0);
         if (Order == null)
         {
             model.FinanceApproveStatus   = -1;
             model.ExpressApproveStatus   = -1;
             model.WarehouseApproveStatus = -1;
             model.Creator    = Convert.ToInt32(Server.UrlDecode(Request.Cookies["UserId"].Value));
             model.CreateTime = DateTime.Now;
             db.T_InterceptLogistics.Add(model);
             db.SaveChanges();
             return(Json(new { State = "Success", Msg = "创建成功" }));
         }
         else
         {
             return(Json(new { State = "Fail", Msg = "创建失败,该订单拦截审批已存在!" }));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { State = "Fail", Msg = "创建失败," + ex.Message }));
     }
 }
        public JsonResult StockDetailAdd(T_StockStorage Model, string jsonStr)
        {
            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value);
                    Model.Type      = "退货";
                    Model.ApplyName = Nickname;
                    Model.ApplyDate = DateTime.Now;
                    db.T_StockStorage.Add(Model);
                    db.SaveChanges();
                    List <T_StockDetail> details = App_Code.Com.Deserialize <T_StockDetail>(jsonStr);


                    foreach (var item in details)
                    {
                        item.Oid = Model.ID;
                        db.T_StockDetail.Add(item);
                        db.SaveChanges();
                        string  code          = item.Code;
                        string  WarehouseCode = Model.WarehouseCode;
                        T_Stock Smodel        = db.T_Stock.SingleOrDefault(a => a.Code == code && a.WarehouseName == WarehouseCode);
                        if (Smodel != null)
                        {
                            Smodel.Qty += item.Qty;
                            db.Entry <T_Stock>(Smodel).State = System.Data.Entity.EntityState.Modified;
                            db.SaveChanges();
                        }
                        else
                        {
                            T_Stock StModel = new T_Stock();
                            StModel.Qty           = item.Qty;
                            StModel.Name          = item.Name;
                            StModel.Code          = item.Code;
                            StModel.WarehouseName = WarehouseCode;
                            db.T_Stock.Add(StModel);
                            db.SaveChanges();
                        }

                        T_StockOutstorage StorageModel = new T_StockOutstorage();
                        StorageModel.Code          = item.Code;
                        StorageModel.Name          = item.Name;
                        StorageModel.WarehouseCode = WarehouseCode;
                        StorageModel.number        = Model.ID.ToString();
                        StorageModel.Qty           = item.Qty;
                        StorageModel.Type          = "入库";
                        db.T_StockOutstorage.Add(StorageModel);
                        db.SaveChanges();
                    }
                    sc.Complete();
                    return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet));
                }
            }
        }
Esempio n. 4
0
        public JsonResult MeetingroomApplySave(T_MeetingRoom model)
        {
            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    string name = Server.UrlDecode(Request.Cookies["NickName"].Value);
                    model.IsDelete = 0;
                    model.PostTime = DateTime.Now;
                    model.Status   = -1;
                    model.Step     = 1;
                    model.PostName = name;
                    //model.CurrentApprove = approveName;
                    db.T_MeetingRoom.Add(model);
                    db.SaveChanges();

                    T_MeetingRoomApprove newApprove = new T_MeetingRoomApprove();
                    newApprove.ApproveName = model.CurrentApprove;
                    newApprove.PID         = model.ID;
                    newApprove.Status      = 0;
                    newApprove.Step        = 1;
                    db.T_MeetingRoomApprove.Add(newApprove);
                    db.SaveChanges();
                    sc.Complete();
                    return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception e)
                {
                    return(Json(new { State = "Faile", Message = e.Message }, JsonRequestBehavior.AllowGet));
                }
            }
        }
        public JsonResult PersonnelPayRaiseApplySave(T_PersonnelPayRaise model)
        {
            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    string approveName = db.T_PersonnelPayRaiseConfig.First(a => a.Step == 1).Name;
                    model.PostTime = DateTime.Now;
                    model.Status   = -1;
                    model.Step     = 1;
                    //model.CurrentApproveName = approveName;
                    model.PostUser = UserModel.Nickname;
                    model.isDelete = 0;
                    db.T_PersonnelPayRaise.Add(model);
                    db.SaveChanges();

                    T_PersonnelPayRaiseApprove newApprove = new T_PersonnelPayRaiseApprove();
                    newApprove.ApproveName = model.CurrentApproveName;
                    newApprove.PID         = model.ID;
                    newApprove.Status      = 0;
                    newApprove.Step        = 1;
                    db.T_PersonnelPayRaiseApprove.Add(newApprove);
                    db.SaveChanges();
                    sc.Complete();
                    return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception e)
                {
                    return(Json(new { State = "Faile", Message = e.Message }, JsonRequestBehavior.AllowGet));
                }
            }
        }
Esempio n. 6
0
        public JsonResult DeleteInvoiceApplyFinance(int ID)
        {
            T_InvoiceApply model = db.T_InvoiceApply.Find(ID);

            model.Isdelete = 1;
            db.Entry <T_InvoiceApply>(model).State = System.Data.Entity.EntityState.Modified;
            int i = db.SaveChanges();

            //ModularByZP();
            return(Json(i, JsonRequestBehavior.AllowGet));
        }
        public JsonResult DeleteInvoiceFinance(int ID)
        {
            T_ManualBilling model = db.T_ManualBilling.Find(ID);

            model.Isdelete = 1;
            db.Entry <T_ManualBilling>(model).State = System.Data.Entity.EntityState.Modified;
            int i = db.SaveChanges();

            return(Json(i, JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
0
 /// <summary>
 /// 修改打印次数
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public JsonResult UpdateprintCountByID(int id)
 {
     try
     {
         T_Payment model = db.T_Payment.Find(id);
         model.PrintCount += 1;
         db.SaveChanges();
         return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { State = "Faile", Message = ex.Message }));
     }
 }
 public JsonResult AddAccountProjectSave(T_AccountantProject model, int Pid)
 {
     try
     {
         List <T_AccountantProject> list = db.T_AccountantProject.Where(s => s.Code.Equals(model.Code) || s.Name.Equals(model.Name)).ToList();
         if (list.Count() != 0)
         {
             return(Json(new { State = "Faile", Message = "已存在该编码或名称" }));
         }
         model.ParentID = Pid;
         db.T_AccountantProject.Add(model);
         db.SaveChanges();
         return(Json(new { State = "Success", ID = model.ID, name = model.Name }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Esempio n. 10
0
        public void ModularByZP()
        {
            List <T_ModularNotaudited> ModularNotaudited = db.T_ModularNotaudited.Where(a => a.ModularName == "招聘").ToList();

            if (ModularNotaudited.Count > 0)
            {
                foreach (var item in ModularNotaudited)
                {
                    db.T_ModularNotaudited.Remove(item);
                }
                db.SaveChanges();
            }
            string         RetreatAppRoveSql   = "select Interviewer as PendingAuditName,COUNT(*) as NotauditedNumber from T_PersonnelInterviewRecord where PID in (select ID from T_PersonnelFile where  Isdelete='0'  and (InterviewState = -1 or InterviewState = 0) )  and  State=0 and Date is null GROUP BY Interviewer";
            List <Modular> RetreatAppRoveQuery = db.Database.SqlQuery <Modular>(RetreatAppRoveSql).ToList();

            // string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value);
            for (int e = 0; e < RetreatAppRoveQuery.Count; e++)
            {
                string PendingAuditName = RetreatAppRoveQuery[e].PendingAuditName;

                T_ModularNotaudited NotauditedModel = db.T_ModularNotaudited.SingleOrDefault(a => a.ModularName == "招聘" && a.PendingAuditName == PendingAuditName);
                if (NotauditedModel != null)
                {
                    NotauditedModel.NotauditedNumber = RetreatAppRoveQuery[e].NotauditedNumber;
                    db.Entry <T_ModularNotaudited>(NotauditedModel).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    T_ModularNotaudited ModularNotauditedModel = new T_ModularNotaudited();
                    ModularNotauditedModel.ModularName      = "招聘";
                    ModularNotauditedModel.RejectNumber     = 0;
                    ModularNotauditedModel.NotauditedNumber = RetreatAppRoveQuery[e].NotauditedNumber;
                    ModularNotauditedModel.PendingAuditName = RetreatAppRoveQuery[e].PendingAuditName;
                    ModularNotauditedModel.ToupdateDate     = DateTime.Now;
                    ModularNotauditedModel.ToupdateName     = "admin";
                    db.T_ModularNotaudited.Add(ModularNotauditedModel);
                }
                db.SaveChanges();
            }
            //招聘部分没有
        }
Esempio n. 11
0
 //新增
 public JsonResult shareAdd(T_MeetShare model)
 {
     using (TransactionScope sc = new TransactionScope())
     {
         try
         {
             var modFlag = db.T_MeetShare.FirstOrDefault(a => a.Season == model.Season && a.Name == model.Name && a.Finals == model.Finals && a.IsDel == 0);
             if (modFlag != null)
             {
                 string resultMsg = "该员工本期已经分享过";
                 if (model.Finals == 1)
                 {
                     resultMsg = "该员工本期已经参加过决赛了";
                 }
                 return(Json(new { State = "Faile", Message = resultMsg }, JsonRequestBehavior.AllowGet));
             }
             var modFlag2 = db.T_MeetShare.FirstOrDefault(a => a.Season == model.Season && a.ShareDate == model.ShareDate && a.IsDel == 0);
             if (modFlag2 != null)
             {
                 return(Json(new { State = "Faile", Message = model.ShareDate + ",已经设置了分享人员" }, JsonRequestBehavior.AllowGet));
             }
             T_MeetShare mod = new T_MeetShare();
             mod.IsDel     = 0;
             mod.IsEnd     = 0;
             mod.Name      = model.Name;
             mod.ShareDate = model.ShareDate;
             mod.Score     = 0;
             mod.Total     = 0;
             mod.Finals    = model.Finals;
             mod.Season    = model.Season;
             db.T_MeetShare.Add(mod);
             db.SaveChanges();
             sc.Complete();
             return(Json(new { State = "Success", Message = "保存成功" }, JsonRequestBehavior.AllowGet));
         }
         catch (Exception ex)
         {
             return(Json(new { State = "Faile", Message = ex.Message }));
         }
     }
 }
Esempio n. 12
0
 public JsonResult RespiratorAddSave(T_RespiratorOrder model, string jsonStr)
 {
     using (TransactionScope sc = new TransactionScope())
     {
         try
         {
             string user = Server.UrlDecode(Request.Cookies["NickName"].Value);
             model.CreateUser = user;
             model.SaleDate   = DateTime.Now;
             db.T_RespiratorOrder.Add(model);
             int i = db.SaveChanges();
             if (i > 0)
             {
                 List <T_RespiratorOrderDetails> detail = Com.Deserialize <T_RespiratorOrderDetails>(jsonStr);
                 if (detail.Count == 0)
                 {
                     return(Json(new { State = "Faile", Message = "请添加详情" }, JsonRequestBehavior.AllowGet));
                 }
                 else
                 {
                     foreach (var item in detail)
                     {
                         item.OrderID = model.ID;
                         db.T_RespiratorOrderDetails.Add(item);
                     }
                     db.SaveChanges();
                 }
             }
             else
             {
                 return(Json(new { State = "Faile", Message = "保存失败" }, JsonRequestBehavior.AllowGet));
             }
             sc.Complete();
             return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
         }
         catch (Exception ex)
         {
             return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet));
         }
     }
 }
        public JsonResult HandwrittenExpressAdd(T_HandwrittenExpress model, string jsonStr)
        {
            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value);
                    model.ApplyName = Nickname;
                    model.ApplyDate = DateTime.Now;
                    model.Status    = -1;
                    model.Step      = 0;
                    model.Isdelete  = 0;

                    db.T_HandwrittenExpress.Add(model);
                    int i = db.SaveChanges();
                    if (i > 0)
                    {
                        T_HandwrittenExpressConfig  modelconfig  = db.T_HandwrittenExpressConfig.SingleOrDefault(a => a.Step == 0 && a.Reason == "1");
                        T_HandwrittenExpressAppRove AppRoveModel = new T_HandwrittenExpressAppRove();
                        AppRoveModel.Status = -1;
                        AppRoveModel.Step   = "0";
                        if (modelconfig.Name == null || modelconfig.Name == "")
                        {
                            AppRoveModel.ApproveName = modelconfig.Type;
                        }
                        else
                        {
                            AppRoveModel.ApproveName = modelconfig.Name;
                        }
                        AppRoveModel.ApproveDName = modelconfig.Type;
                        AppRoveModel.Oid          = model.ID;
                        db.T_HandwrittenExpressAppRove.Add(AppRoveModel);
                        db.SaveChanges();
                    }
                    else
                    {
                        return(Json(new { State = "Faile" }, JsonRequestBehavior.AllowGet));
                    }

                    sc.Complete();
                    return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet));
                }
            }
        }
Esempio n. 14
0
 public static void ModularRejectCount(string PendingAuditName, string ModularName, int Qty = 0)
 {
     try {
         EBMSEntities        db    = new EBMSEntities();
         T_ModularNotaudited model = db.T_ModularNotaudited.FirstOrDefault(a => a.ModularName == ModularName && a.PendingAuditName == PendingAuditName);
         model.ToupdateDate = DateTime.Now;
         model.RejectNumber = model.RejectNumber + Qty;
         db.Entry <T_ModularNotaudited>(model).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
     catch (Exception e)
     {
     }
 }
Esempio n. 15
0
 public JsonResult SuNingDelete(string ids)//删除lazada订单
 {
     try
     {
         string[] Ids = ids.Split(',');
         for (int j = 0; j < Ids.Length; j++)
         {
             int            id       = Convert.ToInt32(Ids[j]);
             T_HtSuNing     delModel = db.T_HtSuNing.Find(id);
             T_HtSuNingItem item     = db.T_HtSuNingItem.FirstOrDefault(s => s.PorderID.Equals(delModel.OrderNumber));
             if (item != null)
             {
                 db.T_HtSuNingItem.Remove(item);
             }
             db.T_HtSuNing.Remove(delModel);
         }
         db.SaveChanges();
         return(Json(new { State = "Success" }));
     }
     catch (Exception ex)
     {
         return(Json(new { State = "Faile", Message = ex.Message }));
     }
 }
Esempio n. 16
0
        /// <summary>
        /// 异常处理
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="status"></param>
        /// <param name="memo"></param>
        /// <returns></returns>
        public JsonResult Check(string CurUser, string Guid, int status, string memo)
        {
            T_Generalize model = db.T_Generalize.SingleOrDefault(s => s.Guid.Equals(Guid));

            if (model.IsDispose == 1)
            {
                return(Json(new { State = "Faile", Message = "该数据已处理" }));
            }
            model.IsDispose = 1;
            db.SaveChanges();
            T_GeneralizeApprove approve = new T_GeneralizeApprove
            {
                ApproveName   = CurUser,
                ApproveTime   = DateTime.Now,
                ApproveStatus = status,
                Memo          = memo,
                Pid           = Guid
            };

            db.T_GeneralizeApprove.Add(approve);
            db.SaveChanges();

            return(Json(new { State = "Success" }));
        }
Esempio n. 17
0
 public JsonResult ViewListJPWDelete(int id = 0)
 {
     using (TransactionScope sc = new TransactionScope())
     {
         try
         {
             T_ManualOrder model = db.T_ManualOrder.Find(id);
             db.T_ManualOrder.Remove(model);
             db.SaveChanges();
             List <T_ManualorderDetail> list = db.T_ManualorderDetail.Where(a => a.OrderCode.Equals(model.platform_code)).ToList();
             foreach (var deleteItem in list)
             {
                 db.T_ManualorderDetail.Remove(deleteItem);
             }
             db.SaveChanges();
             sc.Complete();
             return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
         }
         catch (Exception ex)
         {
             return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet));
         }
     }
 }
Esempio n. 18
0
 public JsonResult MethodAdd(string method, int cashier)
 {
     using (TransactionScope sc = new TransactionScope())
     {
         T_CashbackMethod MOD_Method = new T_CashbackMethod();
         //查出最后一个流程的序号 加1 作为当前新增流程的序号
         List <T_CashbackMethod> MOD = db.Database.SqlQuery <T_CashbackMethod>("select top 1 * from T_CashbackMethod ORDER by Method DESC").ToList();
         int _method = 1;
         if (MOD.Count() != 0)
         {
             _method = int.Parse(MOD[0].Method.ToString()) + 1;
         }
         string[] methodArry = method.Split(',');
         int      t          = 0;
         for (int i = 0; i < methodArry.Length; i++)
         {
             MOD_Method.Name   = methodArry[i];
             MOD_Method.Step   = i;
             MOD_Method.Method = _method;
             if (i == cashier)
             {
                 //设置出纳
                 MOD_Method.Cashier = 1;
             }
             db.T_CashbackMethod.Add(MOD_Method);
             t = db.SaveChanges();
         }
         sc.Complete();
         string result = "保存失败";
         if (t > 0)
         {
             result = "保存成功";
         }
         return(Json(result, JsonRequestBehavior.AllowGet));
     }
 }
Esempio n. 19
0
 public JsonResult DeleteInvoiceFinance(int ID)
 {
     try
     {
         T_WDTHandOrder model = db.T_WDTHandOrder.Find(ID);
         model.Isdelete = 1;
         db.Entry <T_WDTHandOrder>(model).State = System.Data.EntityState.Modified;
         int i = db.SaveChanges();
         return(Json(i, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(0, ex.Message));
     }
 }
Esempio n. 20
0
        /// <summary>
        /// 报价保存
        /// </summary>
        /// <param name="model"></param>
        /// <param name="detailList"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public JsonResult ViewofferAddSave(T_offer model, string detailList, decimal costTotal, decimal offerTotal)
        {
            string name = Server.UrlDecode(Request.Cookies["Nickname"].Value);

            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    List <T_offerDetails> details = Com.Deserialize <T_offerDetails>(detailList);
                    if (string.IsNullOrWhiteSpace(detailList))
                    {
                        return(Json(new { State = "Faile", Message = "详情不能为空" }));
                    }

                    model.offerName  = name;
                    model.offerDate  = DateTime.Now;
                    model.Step       = 0;
                    model.Status     = -1;
                    model.costTotal  = costTotal;
                    model.offerTotal = offerTotal;
                    db.T_offer.Add(model);
                    db.SaveChanges();

                    foreach (var item in details)
                    {
                        item.offerID = model.ID;
                        db.T_offerDetails.Add(item);
                    }
                    db.SaveChanges();

                    T_offerApprove approve = new T_offerApprove
                    {
                        ApproveName = "武装色",
                        Status      = -1,
                        PID         = model.ID
                    };
                    db.T_offerApprove.Add(approve);
                    db.SaveChanges();

                    sc.Complete();
                    return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet));
                }
            }
        }
Esempio n. 21
0
        /// <summary>
        /// 组合商品保存
        /// </summary>
        /// <param name="model"></param>
        /// <param name="detailList"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public JsonResult ProductCodeGenerateAddSave(T_ProductCodeGenerate model, string detailList)
        {
            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    List <T_ProductCodeGenerateDetails> details = Com.Deserialize <T_ProductCodeGenerateDetails>(detailList);
                    string codetype = "";
                    for (int i = 0; i < details.Count; i++)
                    {
                        if (i == 0)
                        {
                            codetype += details[i].CpCode + "|" + details[i].CpNumber;
                        }
                        else
                        {
                            codetype += "|" + details[i].CpCode + "|" + details[i].CpNumber;
                        }
                    }
                    T_ProductCodeGenerate GenerateModel = db.T_ProductCodeGenerate.SingleOrDefault(a => a.CodeType == codetype);
                    if (GenerateModel != null)
                    {
                        return(Json(new { State = "Faile", Message = "该组合已存在" }));
                    }
                    string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value);
                    model.CodeType   = codetype;
                    model.CreateDate = DateTime.Now;
                    model.CreateName = Nickname;
                    db.T_ProductCodeGenerate.Add(model);
                    db.SaveChanges();
                    foreach (var item in details)
                    {
                        item.Oid = model.ID;
                        db.T_ProductCodeGenerateDetails.Add(item);
                    }
                    db.SaveChanges();

                    sc.Complete();
                    return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet));
                }
            }
        }
Esempio n. 22
0
        public JsonResult ApplySave(T_BorrowGoods model, string jsonStr)
        {
            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    string nickName = Server.UrlDecode(Request.Cookies["NickName"].Value);
                    List <T_BorrowGoodsDetail> details = Com.Deserialize <T_BorrowGoodsDetail>(jsonStr);
                    //主表保存
                    model.PostTime = DateTime.Now;
                    model.Status   = -1;
                    model.Step     = 1;
                    model.IsDelete = 0;
                    // model.CurrentApprove = "游神";
                    model.PostUser = nickName;
                    db.T_BorrowGoods.Add(model);
                    int i = db.SaveChanges();
                    if (i > 0)
                    {
                        T_BorrowGoodsApprove Approvemodel = new T_BorrowGoodsApprove();
                        Approvemodel.Status      = -1;
                        Approvemodel.ApproveName = model.CurrentApprove;
                        Approvemodel.Memo        = "";
                        Approvemodel.PID         = model.ID;
                        Approvemodel.Step        = 1;
                        db.T_BorrowGoodsApprove.Add(Approvemodel);
                        foreach (T_BorrowGoodsDetail item in details)
                        {
                            item.Pid = model.ID;
                            db.T_BorrowGoodsDetail.Add(item);
                        }

                        db.SaveChanges();

                        sc.Complete();
                        return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
                    }
                    return(Json(new { State = "Faile", Message = "保存失败" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet));
                }
            }
        }
Esempio n. 23
0
        public JsonResult SecurityCodeApp(T_SecurityCode model)
        {
            string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value);

            model.ApplyName = Nickname;
            model.ApplyDate = DateTime.Now;
            model.Status    = -1;
            model.Step      = 0;
            model.Isdelete  = 0;
            db.T_SecurityCode.Add(model);

            int i = db.SaveChanges();

            if (i > 0)
            {
                T_SecurityCodeConfig  modelconfig  = db.T_SecurityCodeConfig.SingleOrDefault(a => a.Step == 0 && a.Reason == "1");
                T_SecurityCodeAppRove AppRoveModel = new T_SecurityCodeAppRove();
                AppRoveModel.Status = -1;
                AppRoveModel.Step   = "0";
                if (modelconfig.Name == null || modelconfig.Name == "")
                {
                    AppRoveModel.ApproveName = modelconfig.Type;
                }
                else
                {
                    AppRoveModel.ApproveName = modelconfig.Name;
                }
                AppRoveModel.ApproveDName = modelconfig.Type;
                AppRoveModel.Oid          = model.ID;
                db.T_SecurityCodeAppRove.Add(AppRoveModel);
                db.SaveChanges();
                return(Json(i, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(i, JsonRequestBehavior.AllowGet));
            }
        }
        public void ModularByZP()
        {
            List <T_ModularNotaudited> ModularNotaudited = db.T_ModularNotaudited.Where(a => a.ModularName == "部门活动").ToList();

            if (ModularNotaudited.Count > 0)
            {
                foreach (var item in ModularNotaudited)
                {
                    db.T_ModularNotaudited.Remove(item);
                }
                db.SaveChanges();
            }

            string         RetreatAppRoveSql   = " select ApproveName as PendingAuditName,COUNT(*) as NotauditedNumber from  T_DepartmentActivityApprove where Pid in (select ID from T_DepartmentActivity where(Status = -1 or Status = 0) and IsDelete = 0) and Status = 0 and ApproveTime is null GROUP BY ApproveName";
            List <Modular> RetreatAppRoveQuery = db.Database.SqlQuery <Modular>(RetreatAppRoveSql).ToList();
            string         Nickname            = Server.UrlDecode(Request.Cookies["Nickname"].Value);

            for (int e = 0; e < RetreatAppRoveQuery.Count; e++)
            {
                string PendingAuditName = RetreatAppRoveQuery[e].PendingAuditName;

                T_ModularNotaudited NotauditedModel = db.T_ModularNotaudited.SingleOrDefault(a => a.ModularName == "部门活动" && a.PendingAuditName == PendingAuditName);
                if (NotauditedModel != null)
                {
                    NotauditedModel.NotauditedNumber = RetreatAppRoveQuery[e].NotauditedNumber;
                    db.Entry <T_ModularNotaudited>(NotauditedModel).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    T_ModularNotaudited ModularNotauditedModel = new T_ModularNotaudited();
                    ModularNotauditedModel.ModularName      = "部门活动";
                    ModularNotauditedModel.RejectNumber     = 0;
                    ModularNotauditedModel.NotauditedNumber = RetreatAppRoveQuery[e].NotauditedNumber;
                    ModularNotauditedModel.PendingAuditName = RetreatAppRoveQuery[e].PendingAuditName;
                    ModularNotauditedModel.ToupdateDate     = DateTime.Now;
                    ModularNotauditedModel.ToupdateName     = Nickname;
                    db.T_ModularNotaudited.Add(ModularNotauditedModel);
                }
                db.SaveChanges();
            }


            //增加驳回数据
            string         RejectNumberSql   = "select PostUser as PendingAuditName,COUNT(*) as NotauditedNumber from T_DepartmentActivity where Status='2' and IsDelete=0  GROUP BY PostUser  ";
            List <Modular> RejectNumberQuery = db.Database.SqlQuery <Modular>(RejectNumberSql).ToList();

            for (int e = 0; e < RejectNumberQuery.Count; e++)
            {
                string PendingAuditName = RejectNumberQuery[e].PendingAuditName;

                T_ModularNotaudited NotauditedModel = db.T_ModularNotaudited.SingleOrDefault(a => a.ModularName == "部门活动" && a.PendingAuditName == PendingAuditName);
                if (NotauditedModel != null)
                {
                    NotauditedModel.RejectNumber = RejectNumberQuery[e].NotauditedNumber;
                    db.Entry <T_ModularNotaudited>(NotauditedModel).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    T_ModularNotaudited ModularNotauditedModel = new T_ModularNotaudited();
                    ModularNotauditedModel.ModularName      = "部门活动";
                    ModularNotauditedModel.NotauditedNumber = 0;
                    ModularNotauditedModel.RejectNumber     = RejectNumberQuery[e].NotauditedNumber;
                    ModularNotauditedModel.PendingAuditName = RejectNumberQuery[e].PendingAuditName;
                    ModularNotauditedModel.ToupdateDate     = DateTime.Now;
                    ModularNotauditedModel.ToupdateName     = Nickname;
                    db.T_ModularNotaudited.Add(ModularNotauditedModel);
                }
                db.SaveChanges();
            }
        }
Esempio n. 25
0
        public JsonResult ElectronicInvoiceAdd(T_ElectronicInvoice model, string picUrls, string jsonStr)
        {
            string orderNumBer = model.OrderNumber;

            List <T_MajorInvoice> Nmodel = db.T_MajorInvoice.Where(a => a.OrderNumber == orderNumBer && a.Isdelete == "0").ToList();

            if (Nmodel.Count > 0)
            {
                return(Json(-1, JsonRequestBehavior.AllowGet));
            }
            string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value);

            model.PostUser    = Nickname;
            model.PostDate    = DateTime.Now;
            model.Status      = -1;
            model.Step        = 0;
            model.Isdelete    = "0";
            model.Invoicetype = model.ShopName;
            db.T_ElectronicInvoice.Add(model);

            int i = db.SaveChanges();

            if (i > 0)
            {
                List <T_ElectronicInvoiceDetails> details = App_Code.Com.Deserialize <T_ElectronicInvoiceDetails>(jsonStr);
                foreach (var item in details)
                {
                    if (item.specname == "undefined")
                    {
                        item.specname = "/";
                    }
                    item.Oid = model.ID;
                    db.T_ElectronicInvoiceDetails.Add(item);
                }
                db.SaveChanges();
                string InvoiceReason = model.Invoicetype;

                //先查看是选择的什么
                T_ElectronicInvoiceReason modelReason = db.T_ElectronicInvoiceReason.SingleOrDefault(a => a.InvoiceReason == InvoiceReason);

                string modelReasontype = "";
                if (modelReason == null)
                {
                    modelReasontype = "1";
                }
                else
                {
                    modelReasontype = modelReason.Type;
                }
                T_ElectronicInvoiceConfig  modelconfig  = db.T_ElectronicInvoiceConfig.SingleOrDefault(a => a.Step == 0 && a.Reason == modelReasontype);
                T_ElectronicInvoiceAppRove AppRoveModel = new T_ElectronicInvoiceAppRove();
                AppRoveModel.Status = -1;
                AppRoveModel.Step   = "0";
                if (modelconfig.Name == null || modelconfig.Name == "")
                {
                    AppRoveModel.ApproveName = modelconfig.Type;
                }
                else
                {
                    AppRoveModel.ApproveName = modelconfig.Name;
                }
                AppRoveModel.ApproveDName = modelconfig.Type;
                AppRoveModel.Oid          = model.ID;
                db.T_ElectronicInvoiceAppRove.Add(AppRoveModel);
                db.SaveChanges();
                if (picUrls.Length > 0)
                {
                    string[] picArr = picUrls.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string Purl in picArr)
                    {
                        T_ElectronicInvoiceEnclosure IndemnityPic = new T_ElectronicInvoiceEnclosure();
                        IndemnityPic.oid        = model.ID;
                        IndemnityPic.URL        = Purl;
                        IndemnityPic.uploadDate = DateTime.Now;
                        IndemnityPic.uploadName = Nickname;
                        db.T_ElectronicInvoiceEnclosure.Add(IndemnityPic);
                    }
                    db.SaveChanges();
                }

                return(Json(i, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(i, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 26
0
        public JsonResult Check(string CurUser, int approveId, int status, string memo, decimal usedMoney = 0)
        {
            var Approve         = db.T_FreezeApprove.Find(approveId);
            var model           = db.T_Freeze.FirstOrDefault(s => s.ID == Approve.freezeID);
            int step            = model.Step;
            var configNextModel = db.T_FreezeConfig.FirstOrDefault(s => s.Step > step);

            Approve.ApproveTime = DateTime.Now;
            Approve.Memo        = memo;
            try
            {
                //同意
                if (status == 3)
                {
                    Approve.ApproveStatus = 3;
                    //是否存在下一级
                    if (configNextModel != null)
                    {
                        model.Step  = configNextModel.Step;
                        model.state = 1;
                        var approveModel = new T_FreezeApprove();
                        approveModel.ApproveName   = configNextModel.ApproveUser;
                        approveModel.ApproveStatus = -1;
                        approveModel.freezeID      = model.ID;
                        db.T_FreezeApprove.Add(approveModel);
                    }
                    else
                    {
                        if (usedMoney > model.freezeMoney)
                        {
                            return(Json(new { State = "Faile", Message = "使用金额不能大于冻结金额" }, JsonRequestBehavior.AllowGet));
                        }
                        model.state        = 2;
                        model.usedMoney    = usedMoney;
                        model.surplusMoney = model.freezeMoney - model.usedMoney;
                    }
                }
                //不同意
                else
                {
                    Approve.ApproveStatus = 4;
                    model.state           = 4;
                    model.Step            = db.T_FreezeConfig.OrderBy(s => s.Step).First().Step;
                }
                var i = db.SaveChanges();


                if (i > 0)
                {
                    string         RetreatAppRoveSql   = " select ApproveName as PendingAuditName,COUNT(*) as NotauditedNumber from T_FreezeApprove where  freezeID in ( select ID from T_Freeze where isDelete=0 ) and  ApproveStatus=-1 and ApproveTime is null GROUP BY ApproveName ";
                    List <Modular> RetreatAppRoveQuery = db.Database.SqlQuery <Modular>(RetreatAppRoveSql).ToList();
                    string         Nickname            = CurUser;
                    for (int e = 0; e < RetreatAppRoveQuery.Count; e++)
                    {
                        string PendingAuditName = RetreatAppRoveQuery[e].PendingAuditName;

                        T_ModularNotaudited NotauditedModel = db.T_ModularNotaudited.SingleOrDefault(a => a.ModularName == "资金冻结未审核" && a.PendingAuditName == PendingAuditName);
                        if (NotauditedModel != null)
                        {
                            NotauditedModel.NotauditedNumber = RetreatAppRoveQuery[e].NotauditedNumber;
                            db.Entry <T_ModularNotaudited>(NotauditedModel).State = System.Data.EntityState.Modified;
                        }
                        else
                        {
                            T_ModularNotaudited ModularNotauditedModel = new T_ModularNotaudited();
                            ModularNotauditedModel.ModularName      = "资金冻结未审核";
                            ModularNotauditedModel.NotauditedNumber = RetreatAppRoveQuery[e].NotauditedNumber;
                            ModularNotauditedModel.PendingAuditName = RetreatAppRoveQuery[e].PendingAuditName;
                            ModularNotauditedModel.ToupdateDate     = DateTime.Now; ModularNotauditedModel.ToupdateName = Nickname;
                            db.T_ModularNotaudited.Add(ModularNotauditedModel);
                        }
                        db.SaveChanges();
                    }

                    return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { State = "Faile", Message = "操作失败" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 27
0
        //入职附件删除
        public void DeleteModelFile(string path, int ID)
        {
            string strPath = path;

            path = Server.MapPath(path);
            //获得文件对象
            System.IO.FileInfo file = new System.IO.FileInfo(path);
            if (file.Exists)
            {
                file.Delete();//删除
            }
            T_QuitOptions model = db.T_QuitOptions.SingleOrDefault(a => a.Oid == ID && a.Path == strPath);

            if (model != null)
            {
                db.T_QuitOptions.Remove(model);
                db.SaveChanges();
            }
            //file.Create();//文件创建方法
        }
Esempio n. 28
0
        public JsonResult BackupsEmploymentRegistrationAddSave(EmploymentRegistration model)
        {
            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    R_Basics PerFile = model.Basics;
                    PerFile.IsDelete  = 0;
                    PerFile.ApplyDate = DateTime.Now;
                    db.R_Basics.Add(PerFile);
                    db.SaveChanges();
                    foreach (var InterviewRecord in model.Education)
                    {
                        if (!string.IsNullOrWhiteSpace(InterviewRecord.School))
                        {
                            InterviewRecord.BasicsID = PerFile.ID;
                            db.R_Basics_Education.Add(InterviewRecord);
                        }
                    }

                    foreach (var Family in model.Family)
                    {
                        if (!string.IsNullOrWhiteSpace(Family.Name))
                        {
                            Family.BasicsID = PerFile.ID;
                            db.R_Basics_Family.Add(Family);
                        }
                    }


                    foreach (var Reward in model.Reward)
                    {
                        if (!string.IsNullOrWhiteSpace(Reward.CompanyName))
                        {
                            Reward.BasicsID = PerFile.ID;
                            db.R_Basics_Reward.Add(Reward);
                        }
                    }

                    foreach (var Relative in model.Relative)
                    {
                        if (!string.IsNullOrWhiteSpace(Relative.Name))
                        {
                            Relative.BasicsID = PerFile.ID;
                            db.R_Basics_Relative.Add(Relative);
                        }
                    }

                    foreach (var WorkExperience in model.WorkExperience)
                    {
                        if (!string.IsNullOrWhiteSpace(WorkExperience.CorporateName))
                        {
                            WorkExperience.BasicsID = PerFile.ID;
                            db.R_Basics_WorkExperience.Add(WorkExperience);
                        }
                    }
                    foreach (var Title in model.Title)
                    {
                        if (!string.IsNullOrWhiteSpace(Title.TitleInfo))
                        {
                            Title.BasicsID = PerFile.ID;
                            db.R_Basics_Title.Add(Title);
                        }
                    }
                    db.SaveChanges();
                    //   ModularByZP();
                    sc.Complete();
                    return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception e)
                {
                    return(Json(new { State = "Faile", Message = e.Message }, JsonRequestBehavior.AllowGet));
                }
            }
        }
Esempio n. 29
0
        public JsonResult Check(int id, int status, string memo, string checkMan, string CurUser)
        {
            using (TransactionScope sc = new TransactionScope())
            {
                T_LossReportApprove modelApprove = db.T_LossReportApprove.FirstOrDefault(a => a.Oid == id && a.ApproveTime == null);
                T_User MOD_User = db.T_User.FirstOrDefault(a => a.Nickname == CurUser);
                //真名
                string curName = MOD_User.Name;
                T_LossReportApproveConfig financeMod = db.T_LossReportApproveConfig.SingleOrDefault(a => a.Type == "财务主管");//审核财务主管一步
                string financeAdmin = financeMod.Name;
                string result       = "";
                if (modelApprove == null)
                {
                    return(Json("数据可能被删除", JsonRequestBehavior.AllowGet));
                }
                modelApprove.Memo        = memo;
                modelApprove.ApproveTime = DateTime.Now;
                modelApprove.Status      = status;
                db.Entry <T_LossReportApprove>(modelApprove).State = System.Data.EntityState.Modified;
                int i = db.SaveChanges();
                if (i > 0)
                {
                    T_LossReport        model      = db.T_LossReport.Find(id);
                    T_LossReportApprove newApprove = new T_LossReportApprove();
                    if (model == null)
                    {
                        return(Json("数据可能被删除", JsonRequestBehavior.AllowGet));
                    }
                    if (status == 1)
                    {
                        //同意
                        int step = int.Parse(model.Step.ToString());
                        step++;
                        IQueryable <T_LossReportApproveConfig> config = db.T_LossReportApproveConfig.AsQueryable();
                        int stepLength = config.Count();//总共步骤
                        if (step < stepLength)
                        {
                            //不是最后一步,主表状态为0 =>审核中
                            model.Status = 0;
                            T_LossReportApproveConfig stepMod = db.T_LossReportApproveConfig.SingleOrDefault(a => a.Step == step);
                            string nextName = stepMod.Name;
                            //下一步审核人不是null  审核记录插入一条新纪录
                            newApprove.Memo   = "";
                            newApprove.Oid    = id;
                            newApprove.Status = -1;
                            if (nextName != null)
                            {
                                newApprove.ApproveName = nextName;
                            }
                            if (curName == financeAdmin && model.Step > 0) //如果是以财务主管来审核
                            {
                                newApprove.ApproveName = checkMan;
                            }
                            db.T_LossReportApprove.Add(newApprove);
                            db.SaveChanges();
                        }
                        else
                        {
                            //最后一步,主表状态改为 1 => 同意
                            model.Status = status;
                        }
                        model.Step = step;
                        db.Entry <T_LossReport>(model).State = System.Data.EntityState.Modified;
                        int j = db.SaveChanges();
                        if (j > 0)
                        {
                            result = "保存成功";
                        }
                        else
                        {
                            result = "保存失败";
                        }
                    }
                    else
                    {
                        //不同意
                        model.Step   = 0;
                        model.Status = 2;
                        db.Entry <T_LossReport>(model).State = System.Data.EntityState.Modified;
                        db.SaveChanges();
                        //审核流程结束 申请人编辑后插入下一条记录
                        result = "保存成功";
                    }
                }
                else
                {
                    result = "保存失败";
                }
                string         RetreatAppRoveSql   = " select ApproveName as PendingAuditName,COUNT(*) as NotauditedNumber from T_LossReportApprove where  Oid in ( select ID from T_LossReport where Status!=3 and IsDelete=0 ) and  Status=-1 and ApproveTime is null GROUP BY ApproveName ";
                List <Modular> RetreatAppRoveQuery = db.Database.SqlQuery <Modular>(RetreatAppRoveSql).ToList();
                string         Nickname            = CurUser;
                for (int e = 0; e < RetreatAppRoveQuery.Count; e++)
                {
                    string PendingAuditName = RetreatAppRoveQuery[e].PendingAuditName;

                    T_ModularNotaudited NotauditedModel = db.T_ModularNotaudited.SingleOrDefault(a => a.ModularName == "报损" && a.PendingAuditName == PendingAuditName);
                    if (NotauditedModel != null)
                    {
                        NotauditedModel.NotauditedNumber = RetreatAppRoveQuery[e].NotauditedNumber;
                        db.Entry <T_ModularNotaudited>(NotauditedModel).State = System.Data.EntityState.Modified;
                    }
                    else
                    {
                        T_ModularNotaudited ModularNotauditedModel = new T_ModularNotaudited();
                        ModularNotauditedModel.ModularName      = "报损";
                        ModularNotauditedModel.NotauditedNumber = RetreatAppRoveQuery[e].NotauditedNumber;
                        ModularNotauditedModel.PendingAuditName = RetreatAppRoveQuery[e].PendingAuditName;
                        ModularNotauditedModel.ToupdateDate     = DateTime.Now; ModularNotauditedModel.ToupdateName = Nickname;
                        db.T_ModularNotaudited.Add(ModularNotauditedModel);
                    }
                    db.SaveChanges();
                }


                sc.Complete();
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 30
0
        public JsonResult Login(string UserName, string Password, string remenberMe)
        {
            T_User curUser = db.T_User.FirstOrDefault(a => (a.Nickname == UserName || a.Tel == UserName) && a.PassWord == Password);

            if (curUser == null)
            {
                return(Json(new { message = "用户名或密码错误" }, JsonRequestBehavior.AllowGet));
            }
            string sUserId = curUser.ID.ToString();

            Response.Cookies["Nickname"].Value = Server.UrlEncode(curUser.Nickname);
            Response.Cookies["Name"].Value     = Server.UrlEncode(curUser.Name);
            Response.Cookies["UserId"].Value   = Server.UrlEncode(sUserId);
            Response.Cookies["pasword"].Value  = Server.UrlEncode(curUser.PassWord);
            if (remenberMe == "1")
            {
                Response.Cookies["zh"].Value   = Server.UrlEncode(curUser.Nickname);
                Response.Cookies["mm"].Value   = Server.UrlEncode(curUser.PassWord);
                Response.Cookies["zh"].Expires = DateTime.MaxValue;
                Response.Cookies["mm"].Expires = DateTime.MaxValue;
            }
            if (remenberMe == "0")
            {
                Response.Cookies["zh"].Value   = "";
                Response.Cookies["zh"].Expires = DateTime.Now.AddDays(-1);
                Response.Cookies["mm"].Value   = "";
                Response.Cookies["mm"].Expires = DateTime.Now.AddDays(-1);
            }
            Response.Cookies["ID"].Value = Server.UrlEncode(curUser.ID.ToString());
            if (curUser.Power == null || curUser.Power == "0")
            {
                Response.Cookies["UserPower"].Value = "0";
                return(Json(new { message = "您没有权限使用本系统" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                Response.Cookies["UserPower"].Value = curUser.Power;
                FormsAuthentication.SetAuthCookie(Server.UrlEncode(curUser.Nickname), true);
                string   ip    = Request.UserHostAddress;
                string   time  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                T_Syslog model = new T_Syslog
                {
                    Operator   = curUser.Nickname,
                    CreateTime = time,
                    IP         = ip,
                    Contentlog = string.Format("操作人:{0},操作时间:{1},IP地址:{2}", curUser.Nickname, time, ip),
                    Type       = "登录日志"
                };
                db.T_Syslog.Add(model);
                db.SaveChanges();
                string curZh = "";
                string curMm = "";
                if (Request.Cookies["zh"] != null && Request.Cookies["mm"] != null)
                {
                    curZh = Server.UrlDecode(Request.Cookies["zh"].Value);
                    curMm = Server.UrlDecode(Request.Cookies["mm"].Value);
                }

                return(Json(new { message = "1", myAccount = curZh, myPassWord = curMm, CurUser = curUser.Nickname }, JsonRequestBehavior.AllowGet));
            }
        }