Esempio n. 1
0
        /// <summary>
        /// 导入工人当天工作信息
        /// </summary>
        /// <param name="selectName"></param>
        /// <param name="date"></param>
        /// <param name="selectWorkSite"></param>
        /// <param name="work">当天工时</param>
        /// <param name="workMore">加班工时</param>
        /// <param name="remark">工作日志</param>
        /// <returns></returns>
        public HttpResponseMessage GetImportWork(string selectWeather, string selectName, string date, string selectWorkSite,
                                                 string work, string workMore, string remark)
        {
            using (WorkDataClassesDataContext db = new WorkDataClassesDataContext())
            {
                string workId     = BasicMethods.GetWorkerId(selectName);
                int    workSiteId = BasicMethods.GetWorkerSiteId(selectWorkSite);


                Attendance att = new Attendance
                {
                    RecordTime  = DateTime.Now,
                    WorkId      = workId,
                    WorkSiteId  = workSiteId,
                    WorkDate    = Convert.ToDateTime(date),
                    WorkTime    = Convert.ToDouble(work),
                    WorkMore    = Convert.ToDouble(workMore),
                    WorkQuality = remark,
                    Weather     = selectWeather
                };

                string json = InsertAttendance(att);
                json = JsonConvert.SerializeObject(json);
                return(HttpResponseMessageToJson.ToJson(json));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 导入工人工资支付情况
        /// </summary>
        /// <param name="selectName"></param>
        /// <param name="date"></param>
        /// <param name="selectWorkSite"></param>
        /// <param name="wageCard">CCB、JS、Cash </param>
        /// <param name="pay">金额</param>
        /// <param name="payType">支付方式</param>
        /// <param name="remark">缘由</param>
        /// <returns></returns>
        public HttpResponseMessage GetImportPay(string selectName, string date, string selectWorkSite,
                                                string wageCard, string pay, string payType, string remark)
        {
            using (WorkDataClassesDataContext db = new WorkDataClassesDataContext())
            {
                string workId     = BasicMethods.GetWorkerId(selectName);
                int    workSiteId = BasicMethods.GetWorkerSiteId(selectWorkSite);


                Payment p = new Payment
                {
                    RecordTime      = DateTime.Now,
                    WorkId          = workId,
                    WorkSiteId      = workSiteId,
                    WagePaymentDate = Convert.ToDateTime(date),
                    WageAmount      = Convert.ToInt16(pay),
                    PaymentType     = payType,
                    WageCard        = wageCard,
                    Remark          = remark
                };

                string json = InsertPayment(p);
                json = JsonConvert.SerializeObject(json);
                return(HttpResponseMessageToJson.ToJson(json));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 修改工人当天工作信息
        /// </summary>
        /// <param name="selectName"></param>
        /// <param name="date"></param>
        /// <param name="selectWorkSite"></param>
        /// <param name="work">当天工时</param>
        /// <param name="workMore">加班工时</param>
        /// <param name="remark">工作日志</param>
        /// <returns></returns>
        public HttpResponseMessage GetUpdateWork(string name, string date, string selectWorkSite,
                                                 string work, string workMore, string remark)
        {
            using (WorkDataClassesDataContext db = new WorkDataClassesDataContext())
            {
                string workId     = BasicMethods.GetWorkerId(name);
                int    workSiteId = BasicMethods.GetWorkerSiteId(selectWorkSite);


                Attendance att = new Attendance
                {
                    RecordTime  = DateTime.Now,
                    WorkId      = workId,
                    WorkSiteId  = workSiteId,
                    WorkDate    = Convert.ToDateTime(date),
                    WorkTime    = Convert.ToDouble(work),
                    WorkMore    = Convert.ToDouble(workMore),
                    WorkQuality = remark
                };
                Attendance modifyAtt = db.Attendance.Where(n => n.WorkDate == att.WorkDate &&
                                                           n.WorkId == att.WorkId && n.WorkSiteId == att.WorkSiteId).SingleOrDefault();

                string json;
                if (modifyAtt != null)
                {
                    //不能直接更新在原表里,放在remark
                    //modifyAtt.WorkTime = att.WorkTime;
                    //modifyAtt.WorkMore = att.WorkMore;
                    modifyAtt.Remark = att.RecordTime + "+" + att.WorkTime + "+" + att.WorkMore + "+" + att.WorkQuality;
                    db.SubmitChanges();
                    json = "ok";
                }
                else
                {
                    json = "error";
                }

                json = JsonConvert.SerializeObject(json);
                return(HttpResponseMessageToJson.ToJson(json));
            }
        }