Exemplo n.º 1
0
        public InterfaceRet UpdateTrainman(string data)
        {
            _ret.Clear();
            try
            {
                Get_InUpTrainmanMgr input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InUpTrainmanMgr>(data);
                DBTrainman          db    = new DBTrainman();
                if (!db.UpdateTrainman(input.trainman))
                {
                    _ret.result    = 1;
                    _ret.resultStr = "未找到待修改的人员,刷新后再试!";
                }
                else
                {
                    AddLog(2, Newtonsoft.Json.JsonConvert.SerializeObject(input.trainman), input.trainman.strTrainmanGUID, strIdentifier_user);
                }
            }
            catch (Exception ex)
            {
                _ret.result    = 1;
                _ret.resultStr = "提交失败:" + ex.Message;
            }

            return(_ret);
        }
Exemplo n.º 2
0
        public Get_OutAddTrainmanMgr AddTrainman(string data)
        {
            Get_InAddTrainmanMgr  model = null;
            Get_OutAddTrainmanMgr json  = new Get_OutAddTrainmanMgr();

            //data = HttpUtility.UrlDecode(data);
            try
            {
                model = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InAddTrainmanMgr>(data);
                DBTrainman db = new DBTrainman();
                if (db.AddTrainman(model.Trainman))
                {
                    json.result    = "0";
                    json.resultStr = "返回成功,成功插入一条数据!";
                    AddLog(1, Newtonsoft.Json.JsonConvert.SerializeObject(model.Trainman), model.Trainman.strTrainmanGUID, strIdentifier_user);
                }
                else
                {
                    json.result    = "1";
                    json.resultStr = "返回失败,请查找原因!";
                }
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }

            return(json);
        }
Exemplo n.º 3
0
        public Get_OutSetTrainmanState SetTrainmanState(string data)
        {
            Get_InSetTrainmanState  model = null;
            Get_OutSetTrainmanState json  = new Get_OutSetTrainmanState();

            try
            {
                model = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InSetTrainmanState>(data);
                DBTrainman db = new DBTrainman();
                int        i  = db.SetTrainmanState(model.nTrainmanState, model.strTrainmanGUID);

                if (i >= 1)
                {
                    json.result    = "0";
                    json.resultStr = "返回成功,成功更新" + i + "条数据!";
                }
                else if (i == 0)
                {
                    json.result    = "1";
                    json.resultStr = "找不到该记录!";
                }
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
Exemplo n.º 4
0
        public Get_OutClearFinger ClearFinger(string data)
        {
            Get_InClearFinger  model = null;
            Get_OutClearFinger json  = new Get_OutClearFinger();

            try
            {
                model = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InClearFinger>(data);
                DBTrainman db = new DBTrainman();
                if (db.ClearFinger(model.TrainmanGUID))
                {
                    json.result    = "0";
                    json.resultStr = "返回成功,成功更新一条数据!";
                    AddLog(3, "", db.GetTrainmanNumberByGuid(model.TrainmanGUID), strIdentifier_zhiwen);
                }
                else
                {
                    json.result    = "1";
                    json.resultStr = "返回失败,请查找原因!";
                }
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
Exemplo n.º 5
0
        public Get_OutUpdateTrainmanTel UpdateTrainmanTel(string data)
        {
            Get_InUpdateTrainmanTel  model = null;
            Get_OutUpdateTrainmanTel json  = new Get_OutUpdateTrainmanTel();

            try
            {
                model = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InUpdateTrainmanTel>(data);
                DBTrainman db = new DBTrainman();
                if (db.UpdateTrainmanTel(model.TrainmanGUID, model.TrainmanTel, model.TrainmanMobile, model.TrainmanAddress, model.TrainmanRemark))
                {
                    LCYAPlatTrainman.UpdateUserTel(model.TrainmanGUID, model.TrainmanTel);
                    json.result    = "0";
                    json.resultStr = "返回成功,成功更新一条数据!";
                }
                else
                {
                    json.result    = "1";
                    json.resultStr = "返回失败,更新0条数据!";
                }
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
Exemplo n.º 6
0
        public Get_OutUpdateFingerAndPicr UpdateFingerAndPic(string data)
        {
            Get_InUpdateFingerAndPic   model = null;
            Get_OutUpdateFingerAndPicr json  = new Get_OutUpdateFingerAndPicr();

            try
            {
                //data = HttpUtility.UrlDecode(data);
                model = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InUpdateFingerAndPic>(data);
                DBTrainman db = new DBTrainman();
                bool       updateFingerPrint = false;
                bool       updatePicture     = false;
                int        i = db.UpdateFingerAndPic(model.trainman, out updateFingerPrint, out updatePicture);
                if (i == 1)
                {
                    json.result    = "0";
                    json.resultStr = "返回成功,成功更新一条数据!";
                    if (updateFingerPrint)  //指纹
                    {
                        FingerPrint FingerPrint_m = new FingerPrint();
                        FingerPrint_m.ID      = model.trainman.nID;
                        FingerPrint_m.Number  = model.trainman.strTrainmanNumber;
                        FingerPrint_m.Finger1 = model.trainman.FingerPrint1;
                        FingerPrint_m.Finger2 = model.trainman.FingerPrint2;
                        AddLog(2, Newtonsoft.Json.JsonConvert.SerializeObject(FingerPrint_m), model.trainman.strTrainmanNumber, strIdentifier_zhiwen);
                    }
                    if (updatePicture)    //图片
                    {
                        Picture Picture_m = new Picture();
                        Picture_m.ID     = model.trainman.nID;
                        Picture_m.Number = model.trainman.strTrainmanNumber;
                        Picture_m.Pic    = model.trainman.Picture;
                        AddLog(2, Newtonsoft.Json.JsonConvert.SerializeObject(Picture_m), model.trainman.strTrainmanNumber, strIdentifier_zhaopian);
                    }
                }
                else if (i == 2)
                {
                    json.result    = "1";
                    json.resultStr = "所传对象为空!修改失败!";
                }
                else if (i == 3)
                {
                    json.result    = "0";
                    json.resultStr = "未修改任何照片或指纹!";
                }
                else if (i == 0)
                {
                    json.result    = "1";
                    json.resultStr = "找不到该记录!";
                }
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
Exemplo n.º 7
0
        public InterfaceRet DelTrainman(string data)
        {
            _ret.Clear();
            try
            {
                //反序列化传入的参数
                Get_InDelTrainmanMgr input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InDelTrainmanMgr>(data);



                DBTrainman db = new DBTrainman();
                if (!db.CheckIsCanUpdata(input.TrainmanGUID))
                {
                    throw new Exception("请将该人员移除名牌后,再进行修改操作!");
                }

                if (!db.CheckIsCanUpdataByPlan(input.TrainmanGUID))
                {
                    throw new Exception("该司机有出勤计划,不能删除!");
                }

                if (!db.CheckIsCanDelUnRun(input.TrainmanGUID))
                {
                    throw new Exception("该司机处于请假状态,不能删除");
                }

                //获取待删除人员的所有信息
                _ret.result    = 1;
                _ret.resultStr = "未找到要修改的人员,刷新后再试!";
                DBTrainman.Tm tm = db.getTmByID(input.TrainmanGUID);
                if (db.DelTrainman(input.TrainmanGUID))
                {
                    _ret.result    = 0;
                    _ret.resultStr = "返回成功";
                    AddLog(3, "", input.TrainmanGUID, strIdentifier_user);
                    //添加名牌变动日志
                    db.addLog4DelTrainMan(tm, input.DutyUserGUID, input.DutyUserNumber, input.DutyUserName);
                }
            }
            catch (Exception ex)
            {
                _ret.result    = 1;
                _ret.resultStr = "提交失败:" + ex.Message;
            }
            return(_ret);
        }
Exemplo n.º 8
0
        public Get_OutGetTrainman GetTrainman(string data)
        {
            Get_OutGetTrainman json = new Get_OutGetTrainman();

            try
            {
                Get_InGetTrainman input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InGetTrainman>(data);
                DBTrainman        db    = new DBTrainman();
                ResultGetTrainman r     = new ResultGetTrainman();
                r.trainmanArray = db.GetTrainman(input.TrainmanGUID, input.Option);
                json.data       = r;
                json.result     = "0";
                json.resultStr  = "返回成功";
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
Exemplo n.º 9
0
        public Get_OutExistNumber ExistNumber(string data)
        {
            Get_OutExistNumber json = new Get_OutExistNumber();

            try
            {
                Get_InExistNumber input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InExistNumber>(data);
                DBTrainman        db    = new DBTrainman();
                ResultExistNumber r     = new ResultExistNumber();
                r.result       = db.ExistNumber(input.TrainmanGUID, input.TrainmanNumber);
                json.data      = r;
                json.result    = "0";
                json.resultStr = "返回成功";
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
Exemplo n.º 10
0
        public void UpdateTrainJiaoLu(TmOrg input, DBTrainman.Tm tm)
        {
            if (string.IsNullOrEmpty(input.TrainmanNumber))
            {
                throw new Exception("传入人员工号为空,无法修改");
            }
            DBTrainman db = new DBTrainman();

            //判断是否在牌  如果在牌 则需要移除
            if (!db.CheckIsCanUpdata(tm.strTrainmanGUID))
            {
                throw new Exception("请将该人员移除名牌后,再进行修改操作!");
            }
            //执行修改操作
            if (!db.UpdateTrainJiaolu(tm.strTrainmanGUID, input.TrainJiaoluGUID))
            {
                throw new Exception("未找到待修改的人员!");
            }
            //添加名牌变动日志
            db.addLog4UpdateTrainmanJiaolu(tm, input.TrainJiaoluGUID, input.DutyUserGUID, input.DutyUserNumber, input.DutyUserName);
        }
Exemplo n.º 11
0
        public Get_OutGetTrainmansBrief GetTrainmansBrief(string data)
        {
            Get_OutGetTrainmansBrief json = new Get_OutGetTrainmansBrief();

            try
            {
                Get_InGetTrainmansBrief input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InGetTrainmansBrief>(data);
                DBTrainman db             = new DBTrainman();
                ResultGetTrainmansBrief r = new ResultGetTrainmansBrief();
                r.trainmanArray = db.GetTrainmansBrief(input.startNid, input.nCount, input.option, out r.nTotalCount);

                json.data      = r;
                json.result    = "0";
                json.resultStr = "返回成功";
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
Exemplo n.º 12
0
        public Get_OutQueryTrainmans_blobFlag QueryTrainmans_blobFlag(string data)
        {
            Get_OutQueryTrainmans_blobFlag json = new Get_OutQueryTrainmans_blobFlag();

            try
            {
                Get_InQueryTrainmans_blobFlag input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InQueryTrainmans_blobFlag>(data);
                DBTrainman db       = new DBTrainman();
                Result     r        = new Result();
                int        allcount = 0;
                r.trainmanArray = db.QueryTrainmans_blobFlag(input.QueryTrainman, input.pageindex, ref allcount);;
                r.nTotalCount   = allcount;
                json.data       = r;
                json.result     = "0";
                json.resultStr  = "返回成功";
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
Exemplo n.º 13
0
        public Get_OutGetPopupTrainmans GetPopupTrainmans(string data)
        {
            Get_OutGetPopupTrainmans json = new Get_OutGetPopupTrainmans();

            try
            {
                Get_InGetPopupTrainmans input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InGetPopupTrainmans>(data);
                DBTrainman db             = new DBTrainman();
                ResultGetPopupTrainmans r = new ResultGetPopupTrainmans();
                int allcount = 0;
                r.trainmanArray = db.GetPopupTrainmans(input.WorkShopGUID, input.strKeyName, input.pageindex, out allcount);;
                r.nTotalCount   = allcount;
                json.data       = r;
                json.result     = "0";
                json.resultStr  = "返回成功";
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
Exemplo n.º 14
0
        public InterfaceRet UpdateTMOrg(string data)
        {
            InterfaceRet _ret = new InterfaceRet();

            _ret.Clear();
            DBTrainman db    = new DBTrainman();
            TmOrg      input = Newtonsoft.Json.JsonConvert.DeserializeObject <TmOrg>(data);

            try
            {
                DBTrainman.Tm tm = db.getTm(input.TrainmanNumber);
                if (tm == null)
                {
                    throw new Exception("找不到该司机,请从新输入工号");
                }

                //判断所传机务段是否是空,如果是空直接停止修改
                //if (!string.IsNullOrEmpty(input.AreaGUID))
                //{
                //if (tm.strJiWuDuanGUID != input.AreaGUID) 暂时先不检测
                UpdateArea(input, tm);
                // }

                //判断所传车间是否是空
                if (!string.IsNullOrEmpty(input.WorkShopGUID))
                {
                    if (tm.strWorkShopGUID != input.WorkShopGUID)
                    {
                        UpdateWorkShop(input, tm);

                        ////判断车间是否位于机务段下
                        //if (db.checkWorkShopInArea(input.AreaGUID, input.WorkShopGUID))

                        //else
                        //    throw new Exception("所选车间不属于所选机务段内!");
                    }
                }
                else
                {
                    UpdateWorkShop(input, tm);
                }

                //判断所传区段是否是空,如果是空直接停止修改
                if (!string.IsNullOrEmpty(input.TrainJiaoluGUID))
                {
                    if (tm.strTrainJiaoluGUID != input.TrainJiaoluGUID)
                    {
                        //判断车间是否位于机务段下
                        if (db.checkJiaoluInWorkShop(input.WorkShopGUID, input.TrainJiaoluGUID))
                        {
                            UpdateTrainJiaoLu(input, tm);
                        }
                        else
                        {
                            throw new Exception("所选区段不在所选车间内!");
                        }
                    }
                }
                else
                {
                    UpdateTrainJiaoLu(input, tm);
                }
                return(_ret);
            }
            catch (Exception ex)
            {
                _ret.resultStr = ex.Message;
                _ret.result    = 1;
            }
            return(_ret);
        }