Пример #1
0
        public ActionResult Create([Bind(Include = "Id,employee_id,period_begin,period_end,total_hours,subtotal,federal_tax_witholding,state_tax_witholding,grand_total")] Payroll payroll)
        {
            string errorMessage = "";

            if (ModelState.IsValid)
            {
                if (payroll.ThereAreAvailableTimesheets())
                {
                    payroll.CalculatePayroll(); // calculate the rest of the fields
                    db.Payrolls.Add(payroll);
                    var result = db.SaveChanges();
                    if (result > 0)
                    {
                        if (payroll.ChangeTimesheetsStatus() > 0) // change timesheet status and check result
                        {
                            return(RedirectToAction("Index"));
                        }
                        else
                        {
                            db.Payrolls.Remove(payroll);
                            db.SaveChanges();
                            errorMessage = "Unable to create this payroll. Timesheet updates failed.";
                        }
                    }
                    errorMessage = "Unable to save this payroll.";
                }
                errorMessage = "There are no available timesheets for this period.";
            }
            ViewBag.ErrorMessage      = errorMessage;
            ViewBag.employee_username = db.AspNetUsers.Find(payroll.employee_id).UserName;
            ViewBag.ActionTitle       = "Create ";
            return(View(payroll));
        }
Пример #2
0
 public ActionResult Create([Bind(Include = "Id,category_name")] Product_Category product_Category)
 {
     if (ModelState.IsValid)
     {
         db.Product_Category.Add(product_Category);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ActionTitle = "Create ";
     return(View(product_Category));
 }
Пример #3
0
 public ActionResult Create([Bind(Include = "Id,product_inventory_id,lineitem_unit_quantity,invoice_id")] Invoice_Lineitem invoice_Lineitem, int?optionalID)
 {
     if (ModelState.IsValid)
     {
         db.Invoice_Lineitem.Add(invoice_Lineitem);
         db.SaveChanges();
         Session["InvoiceLineitem"] = null;
         return(RedirectToAction("Edit", "Invoices", new { id = invoice_Lineitem.invoice_id }));
     }
     ViewBag.OptionalID = optionalID;
     return(View(invoice_Lineitem));
 }
Пример #4
0
        public ActionResult Create([Bind(Include = "Id,equipment_name,equipment_short_description,equipment_long_description,equipment_note,equipment_cost,product_id,in_maintenance")] Equipment equipment)
        {
            if (ModelState.IsValid)
            {
                db.Equipments.Add(equipment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.product_id = new SelectList(db.Products, "Id", "product_name", equipment.product_id);
            return(View(equipment));
        }
Пример #5
0
        public ActionResult Create([Bind(Include = "Id,material_id,material_unit_measure,material_unit_quantity,material_unit_cost")] Material_Stock material_Stock)
        {
            if (ModelState.IsValid)
            {
                db.Material_Stock.Add(material_Stock);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.material_id = new SelectList(db.Materials, "Id", "material_name", material_Stock.material_id);
            return(View(material_Stock));
        }
        public ActionResult Create([Bind(Include = "Id,invoice_id,payment_total,payment_type,payment_date,payment_note")] Payment payment)
        {
            if (ModelState.IsValid)
            {
                db.Payments.Add(payment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ActionTitle = "Create ";
            return(View(payment));
        }
Пример #7
0
        public ActionResult Create([Bind(Include = "Id,warehouse_employee_id,driver_employee_id,delivery_date,delivery_cost,is_delivered,invoice_id")] Delivery_Schedule delivery_Schedule)
        {
            if (ModelState.IsValid)
            {
                db.Delivery_Schedule.Add(delivery_Schedule);
                db.SaveChanges();
                Session["DeliverySchedule"] = null;
                return(RedirectToAction("Index"));
            }

            return(View(delivery_Schedule));
        }
        public ActionResult Create([Bind(Include = "Id,product_name,product_short_description,product_long_description,product_note,product_unit_measure,product_unit_cost,product_unit_price,product_category_id")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.product_category_id = new SelectList(db.Product_Category, "Id", "category_name", product.product_category_id);
            ViewBag.ActionTitle         = "Create ";
            return(View(product));
        }
Пример #9
0
        public ActionResult Create([Bind(Include = "Id,material_name,material_description,material_note,product_id")] Material material)
        {
            if (ModelState.IsValid)
            {
                db.Materials.Add(material);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.product_id  = new SelectList(db.Products, "Id", "product_name", material.product_id);
            ViewBag.ActionTitle = "Create ";
            return(View(material));
        }
Пример #10
0
        public ActionResult Create([Bind(Include = "punch_in_time,punch_out_time,timesheet_date")] Timesheet timesheet)
        {
            timesheet.employee_id = User.Identity.GetUserId();
            if (ModelState.IsValid)
            {
                db.Timesheets.Add(timesheet);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.employee_id = new SelectList(db.AspNetUsers, "Id", "Email", timesheet.employee_id);
            ViewBag.ActionTitle = "Create ";
            return(View(timesheet));
        }
Пример #11
0
        public ActionResult Create([Bind(Include = "Id,product_id,unit_quantity,unit_per_package,packaging_cost")] Product_Inventory product_Inventory)
        {
            if (ModelState.IsValid)
            {
                product_Inventory.CalculatePackage();
                db.Product_Inventory.Add(product_Inventory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.product_id  = new SelectList(db.Products, "Id", "product_name", product_Inventory.product_id);
            ViewBag.ActionTitle = "Create ";
            return(View(product_Inventory));
        }
        public ActionResult Create([Bind(Include = "Id,equipment_id,maintenance_date,completion_eta,maintenance_cost,employee_id,maintenance_short_description,maintenance_long_description,maintenance_note")] Equipment_Maintenance equipment_Maintenance)
        {
            if (ModelState.IsValid)
            {
                db.Equipment_Maintenance.Add(equipment_Maintenance);
                db.SaveChanges();
                Session["EquipmentMaintenance"] = null;
                return(RedirectToAction("Index"));
            }

            equipment_Maintenance.AspNetUser = db.AspNetUsers.Find(equipment_Maintenance.employee_id);
            equipment_Maintenance.Equipment  = db.Equipments.Find(equipment_Maintenance.equipment_id);
            return(View(equipment_Maintenance));
        }
        public ActionResult Create([Bind(Include = "Id,ModeOfPaycheck,paycheck_date,payroll_id,payment_type,check_number,direct_deposit_number,payment_amount")] PaycheckModeModel paycheck)
        {
            var newPaycheck = PaycheckModeModel.ToBase(paycheck);

            dbBusiness.Paychecks.Add(newPaycheck);
            var result = dbBusiness.SaveChanges();

            if (result > 0)
            {
                return(RedirectToAction("Index"));
            }

            ViewBag.ActionTitle = "Create ";
            return(View(paycheck));
        }
Пример #14
0
        public ActionResult Create([Bind(Include = "Name,Value,Address")] AspNetBusiness aspNetBusiness)
        {
            if (ModelState.IsValid)
            {
                db.AspNetBusinesses.Add(aspNetBusiness);
                db.AspNetBusinessUsers.Add(new AspNetBusinessUser
                {
                    UserId     = User.Identity.GetUserId(),
                    BusinessId = aspNetBusiness.id
                });
                db.SaveChanges();
                return(RedirectToAction("/Details/" + aspNetBusiness.id));
            }

            return(View(aspNetBusiness));
        }
Пример #15
0
        protected override void OnFlowEnd(T_Qualification_PostTotal entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            if (entity == null)
            {
                return;
            }
            var sql     = string.Format("select * from  T_Qualification_Postqualificationmanagement where T_Qualification_PostTotalID ='{0}'", entity.ID);
            var dt      = HRSQLDB.ExecuteDataTable(sql);
            var dicList = FormulaHelper.DataTableToListDic(dt);

            foreach (var item in dicList)
            {
                var userid = item.GetValue("Users");
                var quali  = BusinessEntities.Set <S_Qualification_Postqualificationmanagement>().FirstOrDefault(p => p.Users == userid);
                if (quali == null)
                {
                    quali    = new S_Qualification_Postqualificationmanagement();
                    quali.ID = FormulaHelper.CreateGuid();
                    BusinessEntities.Set <S_Qualification_Postqualificationmanagement>().Add(quali);
                }
                UpdateEntity <S_Qualification_Postqualificationmanagement>(quali, item);
            }
            BusinessEntities.SaveChanges();

            sql = string.Format("update T_Qualification_Postqualificationmanagement set IsApprove='True' where T_Qualification_PostTotalID ='{0}'", entity.ID);
            HRSQLDB.ExecuteNonQuery(sql);
        }
Пример #16
0
        /// <summary>
        /// 计算所有项目得分并保存
        /// </summary>
        /// <returns></returns>
        public void CalcScore()
        {
            var lstGrade = BusinessEntities.Set <T_Win_ExpertGrade_AwardItems>().ToList();
            var lstID    = lstGrade.GroupBy(x => x.T_Win_ExpertGradeID).Select(x => x.Key).ToList();

            lstID.ForEach(id =>
            {
                //项目下的所有评分
                var lstItem    = BusinessEntities.Set <T_Win_ExpertGrade_AwardItems>().Where(x => x.T_Win_ExpertGradeID == id).OrderByDescending(x => x.Grade).ToList();
                var scoreModel = BusinessEntities.Set <T_Win_ProjectScore>().FirstOrDefault(x => x.ProjectID == id);
                if (lstItem != null && lstItem.Count > 0)
                {
                    scoreModel.HightScore  = lstItem[0].Grade;
                    scoreModel.LowScore    = lstItem[lstItem.Count - 1].Grade;
                    scoreModel.ExpertCount = lstItem.Count.ToString();

                    lstItem.Remove(lstItem[0]);
                    lstItem.Remove(lstItem[lstItem.Count - 1]);

                    scoreModel.AverageScore = ((lstItem.Sum(x => Convert.ToInt32(x.Grade)) / lstItem.Count) * 1.00).ToString();


                    BusinessEntities.SaveChanges();
                }
            });
        }
        //
        // GET: /AutoForm/ProtectionArticleReceive/

        protected override void OnFlowEnd(T_ProtectionArticle_Receive entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            if (entity != null)
            {
                //流程结束之后更新库存数量

                var ledgerModel = BusinessEntities.Set <T_ProtectionArticle_Ledger>().FirstOrDefault();
                if (ledgerModel != null)
                {
                    ledgerModel.SafetyHatQuantity   = (Convert.ToInt32(ledgerModel.SafetyHatQuantity) - Convert.ToInt32(entity.SafetyhatReceiveQuantity)).ToString();
                    ledgerModel.SafetyShoesQuantity = (Convert.ToInt32(ledgerModel.SafetyShoesQuantity) - Convert.ToInt32(entity.SafetyShoesReceiveQuantity)).ToString();
                    var lstShoes = BusinessEntities.Set <T_ProtectionArticle_Receive_SafetyShoesDetail>().Where(x => x.T_ProtectionArticle_ReceiveID == entity.ID).ToList();
                    ledgerModel.Size35Quantity = (Convert.ToInt32(ledgerModel.Size35Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size35))).ToString();
                    ledgerModel.Size36Quantity = (Convert.ToInt32(ledgerModel.Size36Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size36))).ToString();
                    ledgerModel.Size37Quantity = (Convert.ToInt32(ledgerModel.Size37Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size37))).ToString();
                    ledgerModel.Size38Quantity = (Convert.ToInt32(ledgerModel.Size38Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size38))).ToString();
                    ledgerModel.Size39Quantity = (Convert.ToInt32(ledgerModel.Size39Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size39))).ToString();
                    ledgerModel.Size40Quantity = (Convert.ToInt32(ledgerModel.Size40Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size40))).ToString();
                    ledgerModel.Size41Quantity = (Convert.ToInt32(ledgerModel.Size41Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size41))).ToString();
                    ledgerModel.Size42Quantity = (Convert.ToInt32(ledgerModel.Size42Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size42))).ToString();
                    ledgerModel.Size43Quantity = (Convert.ToInt32(ledgerModel.Size43Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size43))).ToString();
                    ledgerModel.Size44Quantity = (Convert.ToInt32(ledgerModel.Size44Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size44))).ToString();
                    ledgerModel.Size45Quantity = (Convert.ToInt32(ledgerModel.Size45Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size45))).ToString();
                    ledgerModel.Size46Quantity = (Convert.ToInt32(ledgerModel.Size46Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size46))).ToString();
                }

                BusinessEntities.SaveChanges();
            }

            base.OnFlowEnd(entity, taskExec, routing);
        }
        protected override void OnFlowEnd(T_Recruitment_Schoolrecruitmentinterview entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            var currentUser = FormulaHelper.GetUserInfo();

            var sentity = new S_E_Recruitment_Schoolrecruitmentinterview()
            {
                ID           = FormulaHelper.CreateGuid(),
                CreateUserID = currentUser.UserID,
                CreateUser   = currentUser.UserName,
                CreateDate   = DateTime.Now,
                T_Recruitment_SchoolrecruitmentinterviewID = entity.ID,

                Major    = string.IsNullOrEmpty(entity.Professional) ? entity.Professional1 : entity.Professional,
                Year     = DateTime.Now.Year,
                Dept     = entity.InterviewDept,
                DeptName = entity.InterviewDeptName,
                IsPass   = entity.IsPass,

                Applicantname        = entity.Applicantname,
                Sex                  = entity.Sex,
                Birth                = entity.Birth,
                Graduateschoolmaster = entity.Graduateschoolmaster,
                Professional         = entity.Professional,
                Graduateschool       = entity.Graduateschool,
                Professional1        = entity.Professional1,
                Graduatetime         = entity.Graduatetime,
                Is211School          = entity.Is211School,
                Is985School          = entity.Is985School,
                Referrer             = entity.Referrer,
                Interviewtime        = entity.Interviewtime,
            };

            BusinessEntities.Set <S_E_Recruitment_Schoolrecruitmentinterview>().Add(sentity);
            BusinessEntities.SaveChanges();
        }
        public JsonResult DelCase()
        {
            var ids = GetQueryString("IDs");

            if (string.IsNullOrEmpty(ids))
            {
                return(Json(""));
            }

            var arr = ids.Split(',');

            foreach (var id in arr)
            {
                var caseInfo = BusinessEntities.Set <T_Lawsuit_CaseInformation>().Find(id);

                if (caseInfo != null)
                {
                    BusinessEntities.Set <T_Lawsuit_CaseInformation>().Remove(caseInfo);

                    var fileList = BusinessEntities.Set <T_Lawsuit_CaseFile>().Where(p => p.CaseID == caseInfo.ID);

                    foreach (var file in fileList)
                    {
                        BusinessEntities.Set <T_Lawsuit_CaseFile>().Remove(file);
                    }
                }
            }
            BusinessEntities.SaveChanges();

            return(Json(""));
        }
        public JsonResult DeleteNode()
        {
            var fullID = Request["FullID"].ToString();

            if (string.IsNullOrEmpty(fullID))
            {
                return(Json(""));
            }

            if (!fullID.Contains("."))
            {
                throw new BusinessException("不能作废整个位置");
            }

            var poss = this.BusinessEntities.Set <S_E_Logistics_OfficePos>().Where(c => c.FullID.StartsWith(fullID)).ToArray();

            foreach (var pos in poss)
            {
                //取消这个节点下关联的办公室详情
                var list = BusinessEntities.Set <T_Logistics_Office>().Where(p => !string.IsNullOrEmpty(p.NodeFullID) && p.NodeFullID.Contains(pos.ID));

                foreach (var item in list)
                {
                    item.NodeFullID = "";
                    item.NodeID     = "";
                }

                BusinessEntities.Set <S_E_Logistics_OfficePos>().Remove(pos);
            }

            BusinessEntities.SaveChanges();

            return(Json(""));
        }
        protected override void OnFlowEnd(T_Recruitment_Socialrecruitmentemployment entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            var currentUser = FormulaHelper.GetUserInfo();

            var sentity = new S_E_Recruitment_Socialrecruitmentemployment()
            {
                ID           = FormulaHelper.CreateGuid(),
                CreateUserID = currentUser.UserID,
                CreateUser   = currentUser.UserName,
                CreateDate   = DateTime.Now,
                T_Recruitment_SocialrecruitmentemploymentID = entity.ID,

                Major    = entity.Professional,
                Year     = DateTime.Now.Year,
                Dept     = entity.Employmentdept,
                DeptName = entity.EmploymentdeptName,
                IsPass   = entity.IsPass,

                Fillperson     = entity.Fillperson,
                Filldate       = entity.Filldate,
                Candidatename  = entity.Candidatename,
                Position       = entity.Position,
                FillpersonName = entity.FillpersonName,

                Monthlysalary = entity.Monthlysalary,
                Annualsalary  = entity.Annualsalary,
                Pretest       = entity.Pretest,
            };

            BusinessEntities.Set <S_E_Recruitment_Socialrecruitmentemployment>().Add(sentity);
            BusinessEntities.SaveChanges();
        }
Пример #22
0
        public ActionResult Add(int?id, int?Quantity)
        {
            string message = "";

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var inventory = db.Product_Inventory.Find(id);

            if (inventory == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (Quantity == null || Quantity == 0)
            {
                message = "Please insert quantity to update " + inventory.Product.product_name.ToString() + "'s Quantity.";
            }

            // if all info are valid
            if (id != null && Quantity != null)
            {
                inventory.unit_quantity  += Convert.ToInt32(Quantity);
                db.Entry(inventory).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
Пример #23
0
        public ActionResult SelectItem(int?id, int?deliveryScheduleID, int?Quantity)
        {
            var newDeliveryLI = db.Delivery_Lineitem.Find(id);

            if (newDeliveryLI != null)
            {
                if (Quantity != null && Quantity > newDeliveryLI.lineitem_unit_quantity)
                {
                    ViewBag.ErrorMessage = "Please enter the quantity as equal or less than linvoice lineitem.";
                }
                else if (deliveryScheduleID != null && Quantity <= newDeliveryLI.lineitem_unit_quantity)
                {
                    newDeliveryLI.delivery_schedule_id = Convert.ToInt32(deliveryScheduleID);

                    // check quantity
                    if (Quantity < newDeliveryLI.lineitem_unit_quantity)
                    {
                        var secondDeliveryLI = new Delivery_Lineitem();
                        secondDeliveryLI.product_inventory_id   = newDeliveryLI.product_inventory_id;
                        secondDeliveryLI.lineitem_unit_quantity = newDeliveryLI.lineitem_unit_quantity - Convert.ToInt32(Quantity);
                        secondDeliveryLI.invoice_lineitem_id    = newDeliveryLI.invoice_lineitem_id;
                        db.Delivery_Lineitem.Add(secondDeliveryLI);
                    }
                    newDeliveryLI.lineitem_unit_quantity = Convert.ToInt32(Quantity);
                    db.Entry(newDeliveryLI).State        = EntityState.Modified;
                    var result = db.SaveChanges();
                    if (result == 0)
                    {
                        return(View("Error"));
                    }
                    return(RedirectToAction("Edit", "Delivery_Schedule", new { id = deliveryScheduleID }));
                }
                else
                {
                    ViewBag.ErrorMessage = "Something went wrong. Please try again.";
                }
            }

            var deliveryQ = db.Delivery_Lineitem.Where(dl => dl.delivery_schedule_id == null).OrderBy(dl => dl.Invoice_Lineitem.invoice_id).ToList();

            foreach (var i in deliveryQ)
            {
                i.CalculateTotal(i.product_inventory_id);
            }
            ViewBag.DeliveryScheduleID = deliveryScheduleID;
            return(View(deliveryQ));
        }
Пример #24
0
        public override JsonResult Delete()
        {
            List <T_EXE_DesignChangeApply> list = new List <T_EXE_DesignChangeApply>();

            if (!string.IsNullOrEmpty(Request["ListIDs"]))
            {
                var Ids = Request["ListIDs"].Split(',');
                list.AddRange(this.BusinessEntities.Set <T_EXE_DesignChangeApply>().Where(a => Ids.Contains(a.ID)).ToList());
            }
            if (!string.IsNullOrEmpty(Request["ID"]))
            {
                var id = Request["ID"];
                list.Add(this.BusinessEntities.Set <T_EXE_DesignChangeApply>().FirstOrDefault(a => a.ID == id));
            }
            foreach (var item in list)
            {
                if (!string.IsNullOrEmpty(item.TaskWorkID))
                {
                    var task = this.GetEntityByID <S_W_TaskWork>(item.TaskWorkID);
                    if (task != null)
                    {
                        if (this.BusinessEntities.Set <T_EXE_ChangeAudit>().Any(a => a.WBSID == task.WBSID))
                        {
                            task.ChangeState = TaskWorkChangeState.AuditFinish.ToString();
                        }
                        else
                        {
                            task.ChangeState = string.Empty;
                        }
                    }
                }
                else
                {
                    foreach (var detail in item.T_EXE_DesignChangeApply_TaskWork.ToList())
                    {
                        var _task = this.GetEntityByID <S_W_TaskWork>(detail.TaskWorkID);
                        if (this.BusinessEntities.Set <T_EXE_ChangeAudit>().Any(a => a.WBSID == _task.WBSID))
                        {
                            _task.ChangeState = TaskWorkChangeState.AuditFinish.ToString();
                        }
                        else
                        {
                            _task.ChangeState = string.Empty;
                        }
                    }
                }
            }

            flowService.Delete(Request["ID"], Request["TaskExecID"], Request["ListIDs"]);



            if (BusinessEntities != null)
            {
                BusinessEntities.SaveChanges();
            }

            return(Json(""));
        }
        public JsonResult DoRetrun()
        {
            var IDs = GetQueryString("IDs");

            BusinessEntities.Set <T_Foreign_Passport>().Where(c => IDs.Contains(c.ID)).Update(c => c.PassportState = "在库");
            BusinessEntities.SaveChanges();
            return(Json(""));
        }
        //
        // GET: /AutoForm/ForeignPassportBorrow/

        protected override void AfterSave(Dictionary <string, string> dic, Base.Logic.Domain.S_UI_Form formInfo, bool isNew)
        {
            if (isNew)
            {
                var PassportID = dic.GetValue("PassportID");
                var Passport   = BusinessEntities.Set <T_Foreign_Passport>().Find(PassportID);
                Passport.PassportState = "借出";
                BusinessEntities.SaveChanges();
            }
        }
Пример #27
0
        public JsonResult DeleteImage()
        {
            string            id     = GetQueryString("ID");
            S_EP_PlotSealInfo entity = BusinessEntities.Set <S_EP_PlotSealInfo>().Find(id);

            if (entity != null)
            {
                entity.SealInfo = null;
            }
            BusinessEntities.SaveChanges();
            return(Json(new { ID = id }));
        }
Пример #28
0
        public JsonResult DeleteImage()
        {
            string id     = GetQueryString("ID");
            var    entity = BusinessEntities.Set <T_Car_Base>().Find(id);

            if (entity != null)
            {
                entity.CarPhoto = null;
            }
            BusinessEntities.SaveChanges();
            return(Json(new { ID = id }));
        }
        protected override void OnFlowEnd(T_PurchaseProject_StateChange entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            if (entity != null)
            {
                //流程结束把变更状态回写到项目立项表中
                var projectModel = BusinessEntities.Set <T_PurchaseProject_ApprovalApply_ProjectList>().FirstOrDefault(x => x.T_PurchaseProject_ApprovalApplyID == entity.Project && x.ProjectName == entity.ProjectName);
                projectModel.ProjectStatus = entity.ChangedState;

                BusinessEntities.SaveChanges();
            }

            base.OnFlowEnd(entity, taskExec, routing);
        }
Пример #30
0
        protected override void OnFlowEnd(T_B_BidProcessApply entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            base.OnFlowEnd(entity, taskExec, routing);
            S_B_Bid bid = BusinessEntities.Set <S_B_Bid>().Find(entity.BidID);

            if (bid == null)
            {
                throw new BusinessException("id为【" + entity.BidID + "】投标数据为空");
            }
            bid.BidFile      = entity.BidFile;
            bid.BidClearFile = entity.BidClearFile;
            bid.BidOtherFile = entity.BidOtherFile;
            BusinessEntities.SaveChanges();
        }
Пример #31
0
    public void Update(Person person)
    {
        using (BusinessEntities context = new BusinessEntities())
        {
            //显示输入新数据的信息
            Display("Current", person);
            var obj = context.Person.Where(x => x.Id == person.Id).First();
            if (obj != null)
                context.ApplyCurrentValues("Person", person);

            //虚拟操作,保证数据能同时加入到上下文当中
            Thread.Sleep(100);
            context.SaveChanges();
        }
    }