Exemplo n.º 1
0
        /// <summary>
        /// 检测电话是否存在
        /// </summary>
        /// <param name="myuservo"></param>
        /// <param name="phone"></param>
        /// <returns></returns>
        public static (bool, string, object) CheckDriverIsHaveFromPhone(UserLoginVO myuservo, string phone)
        {
            sql = makesql.MakeSelectSql(typeof(Model.Model.LC_User), "phone=@phone", new System.Data.SqlClient.SqlParameter[] {
                new System.Data.SqlClient.SqlParameter("@phone", phone)
            });
            ids = db.Read(sql);
            if (!ids.flag)
            {
                return(false, ids.errormsg, null);
            }
            if (!ids.ReadIsOk())
            {
                return(true, "检测电话不存在!", false);
            }
            Model.Model.LC_User lcu_vo = ids.GetVOList <Model.Model.LC_User>()[0];
            if (lcu_vo.ZType.ConvertData <GlobalBLL.AccountTypeEnum>() != AccountTypeEnum.物流公司员工账号)
            {
                return(false, "绑定账号类型不是司机的电话!", null);
            }
            if (lcu_vo.PositionID.ConvertData <PositionEnum>() != PositionEnum.驾驶员)
            {
                return(false, "绑定账号类型不是司机的电话!", null);
            }
            if (lcu_vo.State.ConvertData <UserStateEnum>() != GlobalBLL.UserStateEnum.正常)
            {
                return(false, "您要绑定的司机还没有通过授权!", null);
            }

            return(true, string.Empty, true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据电话绑定物流
        /// </summary>
        /// <param name="myuservo"></param>
        /// <param name="phone"></param>
        /// <returns></returns>
        public static Tuple <bool, string> UserAddFromPhone(UserLoginVO myuservo, string phone)
        {
            string LogisticsUid = string.Empty;

            //获取当前物流是否存在并获取数据
            sql = makesql.MakeSelectSql(typeof(Model.Model.LC_User), "Phone=@Phone", new System.Data.SqlClient.SqlParameter[] {
                new System.Data.SqlClient.SqlParameter("@Phone", phone)
            }, string.Empty, 1);
            ids = db.Read(sql);
            if (!ids.flag)
            {
                return(new Tuple <bool, string>(false, ids.errormsg));
            }
            if (!ids.ReadIsOk())
            {
                return(new Tuple <bool, string>(false, "当前电话号码的物流信息不存在!"));
            }
            Model.Model.LC_User lcu = ids.GetVOList <Model.Model.LC_User>()[0];
            //判断是否为物流
            if (lcu.ZType.ConvertData <GlobalBLL.AccountTypeEnum>() != AccountTypeEnum.物流账号)
            {
                return(new Tuple <bool, string>(false, "此电话并非物流公司电话,请检查电话是否正确!"));
            }
            LogisticsUid = lcu.UID;

            //检查此物流是否已经绑定过了
            sql = makesql.MakeCount(nameof(Model.Model.LC_UserBindLogisticsList), "uid=@uid and LogisticsUid=@LogisticsUid", new System.Data.SqlClient.SqlParameter[] {
                new System.Data.SqlClient.SqlParameter("@uid", myuservo.uid),
                new System.Data.SqlClient.SqlParameter("@LogisticsUid", LogisticsUid)
            });
            ids = db.Read(sql);
            if (!ids.flag)
            {
                return(new Tuple <bool, string>(false, ids.errormsg));
            }
            if (ids.Count() > 0)
            {
                return(new Tuple <bool, string>(false, "当前物流已经绑定过了,无需重新绑定!"));
            }

            //开始绑定
            Model.Model.LC_UserBindLogisticsList ubll = new Model.Model.LC_UserBindLogisticsList()
            {
                CreateTime   = DateTime.Now,
                LogisticsUid = LogisticsUid,
                Uid          = myuservo.uid
            };
            sql = makesql.MakeInsertSQL(ubll);
            ids = db.Exec(sql);
            if (!ids.flag)
            {
                return(new Tuple <bool, string>(false, ids.errormsg));
            }
            if (!ids.ExecOk())
            {
                return(new Tuple <bool, string>(false, "绑定失败请重试!"));
            }
            return(new Tuple <bool, string>(true, string.Empty));
        }
Exemplo n.º 3
0
 public static Tuple <bool, string> UpdateYesOrNo(Model.Model.LC_User LC_User, string UID)
 {
     sql = makesql.MakeUpdateSQL(LC_User, "UID='" + UID + "'");
     ids = db.Exec(sql);
     if (!ids.flag)
     {
         return(new Tuple <bool, string>(false, ids.errormsg));
     }
     if (!ids.ExecOk())
     {
         return(new Tuple <bool, string>(false, "修改失败请重试!"));
     }
     return(new Tuple <bool, string>(true, string.Empty));
 }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lC_User"></param>
        /// <returns></returns>
        public static Tuple <bool, string> Add(Model.Model.LC_User lC_User, GlobalBLL.UserLoginVO loginvo, string LogisticsUid)
        {
            var box = db.CreateTranSandbox((db) =>
            {
                //判断
                if (lC_User.ZType.ConvertData <GlobalBLL.AccountTypeEnum>() == GlobalBLL.AccountTypeEnum.普通用户账号 && LogisticsUid.StrIsNotNull())
                {
                    //获取物流公司账号数据
                    sql = makesql.MakeSelectSql(typeof(Model.Model.LC_User), "uid=@uid", new System.Data.SqlClient.SqlParameter[] {
                        new System.Data.SqlClient.SqlParameter("@uid", LogisticsUid)
                    });
                    ids = db.Read(sql);
                    if (!ids.flag)
                    {
                        return(new Tuple <bool, string>(false, ids.errormsg));
                    }
                    if (!ids.ReadIsOk())
                    {
                        return(new Tuple <bool, string>(false, "没有找到任何物流公司数据!"));
                    }
                    Model.Model.LC_User wl_uservo = ids.GetVOList <Model.Model.LC_User>()[0];
                    lC_User.ProvincesID           = wl_uservo.ProvincesID;
                    lC_User.CityID = wl_uservo.CityID;
                    lC_User.AreaID = wl_uservo.AreaID;

                    //添加查询是否已经绑定过
                    sql = makesql.MakeCount(nameof(Model.Model.LC_UserBindLogisticsList), "uid=@uid", new System.Data.SqlClient.SqlParameter[] {
                        new System.Data.SqlClient.SqlParameter("@uid", lC_User.ZNumber)
                    });
                    ids = db.Read(sql);
                    if (!ids.flag)
                    {
                        return(new Tuple <bool, string>(false, ids.errormsg));
                    }
                    if (ids.Count() == 0)
                    {
                        //添加一个物流绑定
                        sql = makesql.MakeInsertSQL(new Model.Model.LC_UserBindLogisticsList()
                        {
                            CreateTime   = DateTime.Now,
                            LogisticsUid = LogisticsUid,
                            Uid          = loginvo.uid.StrIsNull() ? lC_User.UID : loginvo.uid
                        });
                        ids = db.Exec(sql);
                        if (!ids.flag)
                        {
                            return(new Tuple <bool, string>(false, ids.errormsg));
                        }
                    }
                }
                //if(loginvo.uid.StrIsNull()) //如果没有登陆则创建一个账号
                {
                    //判断账号是否存在
                    sql = makesql.MakeCount(nameof(Model.Model.LC_User), "ZNumber=@ZNumber", new System.Data.SqlClient.SqlParameter[] {
                        new System.Data.SqlClient.SqlParameter("@ZNumber", lC_User.ZNumber)
                    });
                    ids = db.Read(sql);
                    if (!ids.flag)
                    {
                        return(new Tuple <bool, string>(false, ids.errormsg));
                    }
                    if (ids.Count() > 0)
                    {
                        return(new Tuple <bool, string>(false, "此帐号已注册!"));
                    }
                    if (ids.Count() == 0)
                    {
                        sql = makesql.MakeInsertSQL(lC_User);
                        ids = db.Exec(sql);
                        if (!ids.flag)
                        {
                            return(new Tuple <bool, string>(false, ids.errormsg));
                        }
                        if (!ids.ExecOk())
                        {
                            return(new Tuple <bool, string>(false, "注册账号时失败,请重试!"));
                        }
                    }
                }

                db.Commit();
                return(new Tuple <bool, string>(true, string.Empty));
            });

            return(box);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 添加或者更新用户数据
        /// </summary>
        /// <param name="suser"></param>
        /// <returns></returns>
        public static (bool, string, Model.Model.LC_User suser) AddOrUpdateUserVO(Model.Model.LC_User suser)
        {
            var box = db.CreateTranSandbox <(bool, string, Model.Model.LC_User suser)>((db) =>
            {
                //获取用户是否存在
                sql = makesql.MakeSelectSql(typeof(Model.Model.LC_User), "WX_OpenID=@WX_OpenID", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@WX_OpenID", suser.WX_OpenID)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg, null);
                }
                if (ids.ReadIsOk()) //更新数据
                {
                    var ls_usrvo = ids.GetVOList <Model.Model.LC_User>()[0];
                    if (ls_usrvo.ZNumber.StrIsNotNull()) //如果彻底注册成功则不更新用户类型
                    {
                        //更新用户数据
                        //判断是否已经彻底注册完毕
                        suser.ZType      = null;
                        suser.PositionID = null;
                    }
                    //不更新昵称

                    sql = makesql.MakeUpdateSQL(suser, "WX_OpenID=@WX_OpenID");
                }
                else
                {
                    suser.CreateTime = DateTime.Now;
                    suser.UID        = Tools.NewGuid.GuidTo16String();
                    if (suser.ZType <= 0)
                    {
                        return(false, "账号类型不正确!", null);
                    }
                    sql = makesql.MakeInsertSQL(suser);
                }
                ids = db.Exec(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg, null);
                }
                if (!ids.ExecOk())
                {
                    return(false, "更新或添加用户失败!", null);
                }

                //获取最后的数据
                sql = makesql.MakeSelectSql(typeof(Model.Model.LC_User), "WX_OpenID=@WX_OpenID", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@WX_OpenID", suser.WX_OpenID)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg, null);
                }
                if (!ids.ReadIsOk())
                {
                    return(false, "刚注册完的数据消失了???", null);
                }
                Model.Model.LC_User new_suser = ids.GetVOList <Model.Model.LC_User>()[0];

                db.Commit();
                return(true, string.Empty, new_suser);
            });

            return(box);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 普通账号绑定
        /// </summary>
        /// <param name="nickName"></param>
        /// <param name="phone"></param>
        /// <param name="logistics"></param>
        /// <param name="sheng"></param>
        /// <param name="shi"></param>
        /// <param name="qu"></param>
        /// <returns></returns>
        public static (bool, string) OrdinaryAccountBind(UserLoginVO myuservo, string nickName, long phone, string logistics, int sheng, int shi, int qu)
        {
            var box = db.CreateTranSandbox((db) =>
            {
                //检测此物流是否存在
                sql = makesql.MakeCount(nameof(Model.Model.LC_User), "uid=@logistics and ztype=@ztype", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@logistics", logistics),
                    new System.Data.SqlClient.SqlParameter("@ztype", GlobalBLL.AccountTypeEnum.物流账号.EnumToInt())
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (ids.Count() == 0)
                {
                    return(false, "您要绑定的物流不存在!");
                }

                //查看电话号是否存在
                sql = makesql.MakeCount(nameof(Model.Model.LC_User), "Phone=@Phone", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@Phone", phone)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (ids.Count() > 0)
                {
                    return(false, "当前手机号已被使用!");
                }


                //开始绑定
                Model.Model.LC_User user = new Model.Model.LC_User()
                {
                    UserName    = nickName,
                    ZNumber     = phone.ToString(),
                    State       = 1, //默认开通
                    Phone       = phone.ToString(),
                    ProvincesID = sheng,
                    CityID      = shi,
                    AreaID      = qu,
                };
                sql = makesql.MakeUpdateSQL(user, "uid=@uid", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@uid", myuservo.uid)
                });
                ids = db.Exec(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (!ids.ExecOk())
                {
                    return(false, "绑定失败请重试!");
                }

                //添加一个绑定记录
                //查看是否已经绑定过当前物流UID
                sql = makesql.MakeCount(nameof(Model.Model.LC_UserBindLogisticsList), "uid=@uid and LogisticsUid=@LogisticsUid", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@LogisticsUid", logistics),
                    new System.Data.SqlClient.SqlParameter("@uid", myuservo.uid)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (ids.Count() == 0)
                {
                    //添加一个物流绑定
                    sql = makesql.MakeInsertSQL(new Model.Model.LC_UserBindLogisticsList()
                    {
                        CreateTime   = DateTime.Now,
                        LogisticsUid = logistics,
                        Uid          = myuservo.uid
                    });
                    ids = db.Exec(sql);
                    if (!ids.flag)
                    {
                        return(false, ids.errormsg);
                    }
                    if (!ids.ExecOk())
                    {
                        return(false, "添加绑定失败请重试!");
                    }
                }
                db.Commit();
                return(true, string.Empty);
            });

            return(box);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 员工账号绑定
        /// </summary>
        /// <param name="myuservo"></param>
        /// <param name="nickName"></param>
        /// <param name="phone"></param>
        /// <param name="logistics">要绑定到的物流公司</param>
        /// <param name="bindvehicleid">绑定的车辆ID</param>
        /// <returns></returns>
        public static (bool, string) EmployeeAccountBind(UserLoginVO myuservo, string nickName, long phone, string logistics, long bindvehicleid)
        {
            var box = db.CreateTranSandbox((db) =>
            {
                //检测此物流是否存在
                sql = makesql.MakeSelectSql(typeof(Model.Model.LC_User), "uid=@logistics and ztype=@ztype", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@logistics", logistics),
                    new System.Data.SqlClient.SqlParameter("@ztype", GlobalBLL.AccountTypeEnum.物流账号.EnumToInt())
                }, string.Empty, 1);
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (!ids.ReadIsOk())
                {
                    return(false, "您要绑定的物流不存在!");
                }
                Model.Model.LC_User wl_user = ids.GetVOList <Model.Model.LC_User>()[0];

                //查看电话号是否存在
                sql = makesql.MakeCount(nameof(Model.Model.LC_User), "Phone=@Phone", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@Phone", phone)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (ids.Count() > 0)
                {
                    return(false, "当前手机号已被使用!");
                }

                //开始绑定
                Model.Model.LC_User user = new Model.Model.LC_User()
                {
                    UserName    = nickName,
                    ZNumber     = phone.ToString(),
                    Phone       = phone.ToString(),
                    ProvincesID = wl_user.ProvincesID,
                    CityID      = wl_user.CityID,
                    AreaID      = wl_user.AreaID,
                    LCID        = logistics
                };
                sql = makesql.MakeUpdateSQL(user, "uid=@uid", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@uid", myuservo.uid)
                });
                ids = db.Exec(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (!ids.ExecOk())
                {
                    return(false, "绑定失败请重试!");
                }

                //绑定车辆
                if (bindvehicleid > 0)
                {
                    //检测车辆是否存在
                    sql = makesql.MakeCount(nameof(Model.Model.LC_Vehicle), "id=@id", new System.Data.SqlClient.SqlParameter[] {
                        new System.Data.SqlClient.SqlParameter("@id", bindvehicleid)
                    });
                    ids = db.Read(sql);
                    if (!ids.flag)
                    {
                        return(false, ids.errormsg);
                    }
                    if (ids.Count() > 0)
                    {
                        //检测我是否绑定过此车辆
                        sql = makesql.MakeCount(nameof(Model.Model.LC_VehicleBinding), "VehicleID=@VehicleID and DriverUID=@DriverUID", new System.Data.SqlClient.SqlParameter[] {
                            new System.Data.SqlClient.SqlParameter("@VehicleID", bindvehicleid),
                            new System.Data.SqlClient.SqlParameter("@DriverUID", myuservo.uid)
                        });
                        ids = db.Read(sql);
                        if (!ids.flag)
                        {
                            return(false, ids.errormsg);
                        }
                        if (ids.Count() == 0)
                        {
                            //创建一个绑定
                            sql = makesql.MakeInsertSQL(new Model.Model.LC_VehicleBinding()
                            {
                                BindingTime = DateTime.Now,
                                DriverUID   = myuservo.uid,
                                VehicleID   = bindvehicleid
                            });
                            ids = db.Exec(sql);
                            if (!ids.flag)
                            {
                                return(false, ids.errormsg);
                            }
                            if (!ids.ExecOk())
                            {
                                return(false, "添加绑定失败,请重试!");
                            }
                            //更新车辆为可用
                            sql = makesql.MakeUpdateSQL(new Model.Model.LC_Vehicle()
                            {
                                State = 1
                            }, "id=@id", new System.Data.SqlClient.SqlParameter[] {
                                new System.Data.SqlClient.SqlParameter("@id", bindvehicleid)
                            });
                            ids = db.Exec(sql);
                            if (!ids.flag)
                            {
                                return(false, ids.errormsg);
                            }
                            if (!ids.ExecOk())
                            {
                                return(false, "更新车辆状态失败!");
                            }
                        }
                    }
                }
                db.Commit();
                return(true, string.Empty);
            });

            return(box);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 物流公司账号绑定
        /// </summary>
        /// <param name="myuservo"></param>
        /// <param name="nickName"></param>
        /// <param name="phone"></param>
        /// <param name="logistics">要绑定的物流总公司UID</param>
        /// <param name="sheng"></param>
        /// <param name="shi"></param>
        /// <param name="qu"></param>
        /// <param name="lineletter">货号字母</param>
        /// <returns></returns>
        public static (bool, string) LogisticsAccountBind(UserLoginVO myuservo, string nickName, long phone, string logistics, int sheng, int shi, int qu, string lineletter)
        {
            var box = db.CreateTranSandbox((db) =>
            {
                //查看电话号是否存在
                sql = makesql.MakeCount(nameof(Model.Model.LC_User), "Phone=@Phone", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@Phone", phone)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (ids.Count() > 0)
                {
                    return(false, "当前手机号已被使用!");
                }

                //开始绑定
                Model.Model.LC_User user = new Model.Model.LC_User()
                {
                    UserName      = nickName,
                    ZNumber       = phone.ToString(),
                    LogisticsName = nickName,
                    Phone         = phone.ToString(),
                    LCID          = logistics,
                    ProvincesID   = sheng,
                    CityID        = shi,
                    AreaID        = qu,
                    State         = 1
                                    //State = logistics.StrIsNotNull() ? 0 : 1
                };
                sql = makesql.MakeUpdateSQL(user, "uid=@uid", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@uid", myuservo.uid)
                });
                ids = db.Exec(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (!ids.ExecOk())
                {
                    return(false, "绑定失败请重试!");
                }


                //判断是否需要绑定线路
                if (logistics.StrIsNotNull())
                {
                    //获取物流账号是否存在
                    sql = makesql.MakeSelectSql(typeof(Model.Model.LC_User), "uid=@uid", new System.Data.SqlClient.SqlParameter[] {
                        new System.Data.SqlClient.SqlParameter("@uid", logistics)
                    });
                    ids = db.Read(sql);
                    if (!ids.flag)
                    {
                        return(false, ids.errormsg);
                    }
                    if (!ids.ReadIsOk())
                    {
                        return(false, "获取总公司账号错误无法进行操作!");
                    }
                    Model.Model.LC_User df_user = ids.GetVOList <Model.Model.LC_User>()[0];
                    if (df_user.ZType.ConvertData <GlobalBLL.AccountTypeEnum>() != AccountTypeEnum.物流账号)
                    {
                        return(false, "权限错误,无法绑定到总公司!");
                    }
                    //开始双方绑定

                    //查看我是否绑定过此物流
                    sql = makesql.MakeCount(nameof(Model.Model.LC_Line), "uid=@uid and BindLogisticsUid=@BindLogisticsUid", new System.Data.SqlClient.SqlParameter[] {
                        new System.Data.SqlClient.SqlParameter("@uid", myuservo.uid),
                        new System.Data.SqlClient.SqlParameter("@BindLogisticsUid", logistics)
                    });
                    ids = db.Read(sql);
                    if (!ids.flag)
                    {
                        return(false, ids.errormsg);
                    }
                    if (ids.Count() == 0)
                    {
                        //绑定自己的
                        Model.Model.LC_Line myline = new Model.Model.LC_Line()
                        {
                            CreateTime        = DateTime.Now,
                            Start             = qu,
                            End               = df_user.AreaID,
                            LineID            = Tools.NewGuid.GuidTo16String(),
                            Lineletter        = lineletter,
                            MyPhone           = phone.ConvertData(),
                            MyResponsibleName = nickName,
                            DFPhone           = df_user.Phone,
                            DFResponsibleName = df_user.UserName,
                            UID               = myuservo.uid,
                            BindLogisticsUid  = logistics,
                            State             = 0,
                            ApplicantUID      = myuservo.uid
                        };
                        sql = makesql.MakeInsertSQL(myline);
                        ids = db.Exec(sql);
                        if (!ids.flag)
                        {
                            return(false, ids.errormsg);
                        }
                        if (!ids.ExecOk())
                        {
                            return(false, "绑定对方物流数据失败!");
                        }
                    }

                    //查看对方是否绑定过我的物流
                    sql = makesql.MakeCount(nameof(Model.Model.LC_Line), "uid=@uid and BindLogisticsUid=@BindLogisticsUid", new System.Data.SqlClient.SqlParameter[] {
                        new System.Data.SqlClient.SqlParameter("@uid", logistics),
                        new System.Data.SqlClient.SqlParameter("@BindLogisticsUid", myuservo.uid)
                    });
                    ids = db.Read(sql);
                    if (!ids.flag)
                    {
                        return(false, ids.errormsg);
                    }
                    if (ids.Count() == 0)
                    {
                        //绑定对方物流
                        Model.Model.LC_Line dfline = new Model.Model.LC_Line()
                        {
                            Start             = df_user.AreaID,
                            End               = qu,
                            Lineletter        = string.Empty,
                            DFPhone           = phone.ConvertData(),
                            DFResponsibleName = nickName,
                            MyPhone           = df_user.Phone,
                            MyResponsibleName = df_user.UserName,
                            UID               = logistics,
                            BindLogisticsUid  = myuservo.uid,
                            State             = 0,
                            CreateTime        = DateTime.Now,
                            LineID            = Tools.NewGuid.GuidTo16String(),
                            ApplicantUID      = myuservo.uid
                        };
                        sql = makesql.MakeInsertSQL(dfline);
                        ids = db.Exec(sql);
                        if (!ids.flag)
                        {
                            return(false, ids.errormsg);
                        }
                        if (!ids.ExecOk())
                        {
                            return(false, "绑定您的物流数据失败!");
                        }
                    }
                }
                db.Commit();
                return(true, string.Empty);
            });

            return(box);
        }
Exemplo n.º 9
0
 /// <summary>
 /// 添加或者更新账号
 /// </summary>
 /// <param name="web"></param>
 /// <param name="suser"></param>
 /// <param name="rtype">类型</param>
 /// <returns></returns>
 public static (bool, string, Model.Model.LC_User suser) AddOrUpdateUserVO(HttpContextBase web, Model.Model.LC_User suser)
 {
     //验证数据是否正确
     if (suser.WX_OpenID.StrIsNull())
     {
         return(false, "OPENID不能为空!", null);
     }
     return(DAL.DAL.LC_User.AddOrUpdateUserVO(suser));
 }
Exemplo n.º 10
0
 /// <summary>
 /// 注册用户
 /// </summary>
 /// <param name="lC_User"></param>
 /// <returns></returns>
 public static Tuple <bool, string> Add(Model.Model.LC_User lC_User, GlobalBLL.UserLoginVO loginvo, string LogisticsUid = "")
 {
     return(DAL.DAL.LC_User.Add(lC_User, loginvo, LogisticsUid));
 }
Exemplo n.º 11
0
        /// <summary>
        /// 添加车辆
        /// </summary>
        /// <param name="myuservo"></param>
        /// <param name="lcv"></param>
        /// <returns></returns>
        public static (bool, string) AddVehicle(UserLoginVO myuservo, Model.Model.LC_Vehicle lcv)
        {
            var box = db.CreateTranSandbox((db) =>
            {
                Model.Model.LC_User wl_yg_uservo = null;
                string logistics_uid             = myuservo.uid;
                switch (myuservo.accountType)
                {
                case AccountTypeEnum.物流公司员工账号:
                    //获取当前员工账号数据
                    var myuser = GetUserVoFromUID(myuservo.uid);
                    if (!myuser.Item1)
                    {
                        return(false, myuser.Item2);
                    }
                    if (myuser.Item3.PositionID != 1)
                    {
                        return(false, "当前账号不是驾驶员,无法访问此接口!");
                    }
                    logistics_uid = myuser.Item3.LCID;
                    wl_yg_uservo  = myuser.Item3;
                    break;
                }
                lcv.UID = logistics_uid;
                //查看车号是否存在
                sql = makesql.MakeCount(nameof(Model.Model.LC_Vehicle), "VehicleNo=@VehicleNo and UID=@UID", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@VehicleNo", lcv.VehicleNo),
                    new System.Data.SqlClient.SqlParameter("@UID", logistics_uid)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (ids.Count() > 0)
                {
                    return(false, "已经存在相同车号车辆,无法进行添加!");
                }
                //插入数据库
                sql = makesql.MakeInsertSQL(lcv);
                ids = db.Exec(sql, true);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (!ids.ExecOk())
                {
                    return(false, "添加车辆失败!");
                }

                long index = ids.index_id;

                if (myuservo.accountType == AccountTypeEnum.物流账号)
                {
                    sql = makesql.MakeSelectSql(typeof(Model.Model.LC_User), "phone=@phone", new System.Data.SqlClient.SqlParameter[] {
                        new System.Data.SqlClient.SqlParameter("@phone", lcv.Phone)
                    });
                    ids = db.Read(sql);
                    if (!ids.flag)
                    {
                        return(false, ids.errormsg);
                    }
                    if (!ids.ReadIsOk())
                    {
                        return(false, "您要绑定的司机不存在!");
                    }
                    Model.Model.LC_User siji = ids.GetVOList <Model.Model.LC_User>()[0];
                    if (siji.State != 1)
                    {
                        return(false, "当司机账号不可用!");
                    }
                    logistics_uid = siji.UID;
                }

                sql = makesql.MakeInsertSQL(new Model.Model.LC_VehicleBinding()
                {
                    BindingTime = DateTime.Now,
                    DriverUID   = logistics_uid,
                    VehicleID   = index
                });
                ids = db.Exec(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (!ids.ExecOk())
                {
                    return(false, "绑定司机失败!");
                }

                db.Commit();
                return(true, string.Empty);
            });

            return(box);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 合作物流
        /// </summary>
        /// <param name="zNumber"></param>
        /// <param name="pwd"></param>
        /// <param name="bindUid"></param>
        /// <param name="Lineletter">我的物流运号首字母</param>
        /// <param name="bindLineletter">对方物流运号首字母</param>
        /// <returns></returns>
        public static Tuple <bool, string> BindHZ(string zNumber, string pwd, string bindUid, string myLineletter, string bindLineletter)
        {
            var box = db.CreateTranSandbox((db) =>
            {
                //查看您的账号是否存在
                sql = makesql.MakeSelectSql(typeof(Model.Model.LC_User), "zNumber=@zNumber and Password=@Password", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@zNumber", zNumber),
                    new System.Data.SqlClient.SqlParameter("@Password", pwd)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(new Tuple <bool, string>(false, ids.errormsg));
                }
                if (!ids.ReadIsOk())
                {
                    return(new Tuple <bool, string>(false, "没有找到您的账号!"));
                }
                Model.Model.LC_User my_lcu = ids.GetVOList <Model.Model.LC_User>()[0];
                if (my_lcu.ZType.ConvertData <GlobalBLL.AccountTypeEnum>() != GlobalBLL.AccountTypeEnum.物流账号)
                {
                    return(new Tuple <bool, string>(false, "您的账号权限不正确,无法进行操作!"));
                }

                //获取绑定方账号信息
                sql = makesql.MakeSelectSql(typeof(Model.Model.LC_User), "uid=@uid", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@uid", bindUid)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(new Tuple <bool, string>(false, ids.errormsg));
                }
                if (!ids.ReadIsOk())
                {
                    return(new Tuple <bool, string>(false, "没有找到要绑定方的合作物流数据!"));
                }
                Model.Model.LC_User bind_lcu = ids.GetVOList <Model.Model.LC_User>()[0];
                if (bind_lcu.ZType.ConvertData <GlobalBLL.AccountTypeEnum>() != GlobalBLL.AccountTypeEnum.物流账号)
                {
                    return(new Tuple <bool, string>(false, "账号类型不能为空!"));
                }

                #region 开始我方开始绑定

                //查看我是否绑定过
                sql = makesql.MakeCount(nameof(Model.Model.LC_Line), "uid=@uid and BindLogisticsUid=@BindLogisticsUid", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@BindLogisticsUid", bind_lcu.UID),
                    new System.Data.SqlClient.SqlParameter("@uid", my_lcu.UID)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(new Tuple <bool, string>(false, ids.errormsg));
                }
                if (ids.Count() == 0)
                {
                    //绑定我方
                    Model.Model.LC_Line my_ll = new Model.Model.LC_Line()
                    {
                        BindLogisticsUid = bind_lcu.UID,
                        CreateTime       = DateTime.Now,
                        End               = bind_lcu.AreaID,
                        LineID            = Tools.NewGuid.GuidTo16String(),
                        MyPhone           = my_lcu.Phone.ConvertData(),
                        MyResponsibleName = my_lcu.UserName,
                        DFPhone           = bind_lcu.Phone,
                        DFResponsibleName = bind_lcu.UserName,
                        UID               = my_lcu.UID,
                        Start             = my_lcu.AreaID,
                        Lineletter        = myLineletter,
                        ApplicantUID      = my_lcu.UID
                    };
                    //准备添加
                    sql = makesql.MakeInsertSQL(my_ll);
                    ids = db.Exec(sql);
                    if (!ids.flag)
                    {
                        return(new Tuple <bool, string>(false, ids.errormsg));
                    }
                    if (!ids.ExecOk())
                    {
                        return(new Tuple <bool, string>(false, "添加绑定失败!"));
                    }
                }
                #endregion


                //判断是否为相同的账号
                if (bindUid.Equals(my_lcu.UID))
                {
                    return(new Tuple <bool, string>(false, "不能绑定给自己!"));
                }


                if (bind_lcu.AreaID == my_lcu.AreaID)
                {
                    return(new Tuple <bool, string>(false, "不能绑定相同地区的物流!"));
                }

                #region 对方开始绑定
                //查看对方数据是否存在我的物流绑定
                sql = makesql.MakeCount(nameof(Model.Model.LC_Line), "uid=@BindLogisticsUid and BindLogisticsUid=@uid", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@BindLogisticsUid", bind_lcu.UID),
                    new System.Data.SqlClient.SqlParameter("@uid", my_lcu.UID)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(new Tuple <bool, string>(false, ids.errormsg));
                }
                if (ids.Count() == 0)
                {
                    //添加数据绑定
                    Model.Model.LC_Line bind_ll = new Model.Model.LC_Line()
                    {
                        BindLogisticsUid = my_lcu.UID,
                        CreateTime       = DateTime.Now,
                        End               = my_lcu.AreaID,
                        LineID            = Tools.NewGuid.GuidTo16String(),
                        DFPhone           = my_lcu.Phone.ConvertData(),
                        DFResponsibleName = my_lcu.UserName,
                        MyPhone           = bind_lcu.Phone,
                        MyResponsibleName = bind_lcu.UserName,
                        UID               = bind_lcu.UID,
                        Start             = bind_lcu.AreaID,
                        Lineletter        = bindLineletter,
                        ApplicantUID      = my_lcu.UID
                    };
                    sql = makesql.MakeInsertSQL(bind_ll);
                    ids = db.Exec(sql);
                    if (!ids.flag)
                    {
                        return(new Tuple <bool, string>(false, ids.errormsg));
                    }
                    if (!ids.ExecOk())
                    {
                        return(new Tuple <bool, string>(false, "添加绑定失败!"));
                    }
                }
                #endregion
                db.Commit();
                return(new Tuple <bool, string>(true, string.Empty));
            });

            return(box);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 线路绑定
        /// </summary>
        /// <param name="myuservo"></param>
        /// <param name="lineletter">货号字母</param>
        /// <param name="logistics">物流UID</param>
        /// <returns></returns>
        public static (bool, string) LineBinding(UserLoginVO myuservo, string lineletter, string logistics)
        {
            var box = db.CreateTranSandbox((db) =>
            {
                //获取物流账号是否存在
                sql = makesql.MakeSelectSql(typeof(Model.Model.LC_User), "uid=@uid", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@uid", logistics)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (!ids.ReadIsOk())
                {
                    return(false, "获取您要绑定的物流数据操作!");
                }
                Model.Model.LC_User df_user = ids.GetVOList <Model.Model.LC_User>()[0];
                if (df_user.ZType.ConvertData <AccountTypeEnum>() != AccountTypeEnum.物流账号)
                {
                    return(false, "您要绑定的数据不是物流账号!");
                }
                //开始双方绑定

                //查看我是否绑定过此物流
                sql = makesql.MakeCount(nameof(Model.Model.LC_Line), "uid=@uid and BindLogisticsUid=@BindLogisticsUid", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@uid", myuservo.uid),
                    new System.Data.SqlClient.SqlParameter("@BindLogisticsUid", logistics)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (ids.Count() == 0)
                {
                    //绑定自己的
                    Model.Model.LC_Line myline = new Model.Model.LC_Line()
                    {
                        CreateTime        = DateTime.Now,
                        Start             = myuservo.AreaID,
                        End               = df_user.AreaID,
                        LineID            = Tools.NewGuid.GuidTo16String(),
                        Lineletter        = lineletter,
                        MyPhone           = myuservo.phones.ConvertData(),
                        MyResponsibleName = myuservo.username,
                        DFPhone           = df_user.Phone,
                        DFResponsibleName = df_user.UserName,
                        UID               = myuservo.uid,
                        BindLogisticsUid  = logistics,
                        State             = 0,
                        ApplicantUID      = myuservo.uid
                    };
                    sql = makesql.MakeInsertSQL(myline);
                    ids = db.Exec(sql);
                    if (!ids.flag)
                    {
                        return(false, ids.errormsg);
                    }
                    if (!ids.ExecOk())
                    {
                        return(false, "绑定对方物流数据失败!");
                    }
                }

                //查看对方是否绑定过我的物流
                sql = makesql.MakeCount(nameof(Model.Model.LC_Line), "uid=@uid and BindLogisticsUid=@BindLogisticsUid", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@uid", logistics),
                    new System.Data.SqlClient.SqlParameter("@BindLogisticsUid", myuservo.uid)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (ids.Count() == 0)
                {
                    //绑定对方物流
                    Model.Model.LC_Line dfline = new Model.Model.LC_Line()
                    {
                        Start             = df_user.AreaID,
                        End               = myuservo.AreaID,
                        Lineletter        = string.Empty,
                        DFPhone           = myuservo.phones.ConvertData(),
                        DFResponsibleName = myuservo.username,
                        MyPhone           = df_user.Phone,
                        MyResponsibleName = df_user.UserName,
                        UID               = logistics,
                        BindLogisticsUid  = myuservo.uid,
                        State             = 0,
                        CreateTime        = DateTime.Now,
                        LineID            = Tools.NewGuid.GuidTo16String(),
                        ApplicantUID      = myuservo.uid
                    };
                    sql = makesql.MakeInsertSQL(dfline);
                    ids = db.Exec(sql);
                    if (!ids.flag)
                    {
                        return(false, ids.errormsg);
                    }
                    if (!ids.ExecOk())
                    {
                        return(false, "绑定您的物流数据失败!");
                    }
                }
                db.Commit();
                return(true, string.Empty);
            });

            return(box);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 主动绑定线路
        /// </summary>
        /// <param name="myuservo"></param>
        /// <param name="lineletter"></param>
        /// <param name="phone"></param>
        /// <returns></returns>
        public static (bool, string) LineActiveApplication(UserLoginVO myuservo, string lineletter, string phone)
        {
            var box = db.CreateTranSandbox((db) =>
            {
                //查看此物流是否存在
                sql = makesql.MakeSelectSql(typeof(Model.Model.LC_User), "Phone=@Phone", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@Phone", phone)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (!ids.ReadIsOk())
                {
                    return(false, "没有找到您要绑定的物流公司数据!");
                }
                Model.Model.LC_User lcu = ids.GetVOList <Model.Model.LC_User>()[0];
                if (lcu.State != 0)
                {
                    return(false, "当前您要绑定的物流公司不可用!");
                }

                //检测我是否已经绑定过此物流
                sql = makesql.MakeCount(nameof(Model.Model.LC_Line), "UID=@UID and BindLogisticsUid=@BindLogisticsUid", new System.Data.SqlClient.SqlParameter[] {
                    new System.Data.SqlClient.SqlParameter("@UID", myuservo.uid),
                    new System.Data.SqlClient.SqlParameter("@BindLogisticsUid", lcu.UID)
                });
                ids = db.Read(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (ids.Count() > 0)
                {
                    return(false, "不可以重复绑定相同的物流!");
                }

                //开始绑定我的数据
                Model.Model.LC_Line my_line = new Model.Model.LC_Line()
                {
                    ApplicantUID      = myuservo.uid,
                    BindLogisticsUid  = lcu.UID,
                    LineID            = Tools.NewGuid.GuidTo16String(),
                    CreateTime        = DateTime.Now,
                    DFPhone           = lcu.Phone,
                    DFResponsibleName = lcu.UserName,
                    Lineletter        = lineletter,
                    End               = lcu.AreaID,
                    MyPhone           = myuservo.phones,
                    MyResponsibleName = myuservo.username,
                    Start             = myuservo.AreaID,
                    State             = 0,
                    UID               = myuservo.uid,
                };
                //插入数据库
                sql = makesql.MakeInsertSQL(my_line);
                ids = db.Exec(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (!ids.ExecOk())
                {
                    return(false, "绑定失败!");
                }

                //绑定对方数据
                Model.Model.LC_Line df_line = new Model.Model.LC_Line()
                {
                    ApplicantUID      = myuservo.uid,
                    BindLogisticsUid  = myuservo.uid,
                    LineID            = Tools.NewGuid.GuidTo16String(),
                    CreateTime        = DateTime.Now,
                    DFPhone           = myuservo.phones,
                    DFResponsibleName = myuservo.username,
                    End               = myuservo.AreaID,
                    MyPhone           = lcu.Phone,
                    MyResponsibleName = lcu.UserName,
                    Start             = lcu.AreaID,
                    State             = 0,
                    UID               = lcu.UID,
                };
                sql = makesql.MakeInsertSQL(df_line);
                ids = db.Exec(sql);
                if (!ids.flag)
                {
                    return(false, ids.errormsg);
                }
                if (!ids.ExecOk())
                {
                    return(false, "绑定对方数据时失败!");
                }

                db.Commit();
                return(true, string.Empty);
            });

            return(box);
        }