Ejemplo n.º 1
0
        //添加新路线
        public static Tuple <bool, string> Add(Model.Model.LC_Line LC_Line, GlobalBLL.UserLoginVO uservo)
        {
            //查看是否存在
            sql = makesql.MakeCount(nameof(Model.Model.LC_Line), "[End]=@End and uid=@uid", new System.Data.SqlClient.SqlParameter[] {
                new System.Data.SqlClient.SqlParameter("@End", LC_Line.End),
                new System.Data.SqlClient.SqlParameter("@uid", uservo.uid)
            });
            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, "您已经添加过此路线,无需重复添加!"));
            }

            sql = makesql.MakeInsertSQL(LC_Line);
            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));
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public static Tuple <bool, string, List <Dictionary <string, I_ModelBase> > > GetLCFHADDList(GlobalBLL.UserLoginVO myuservo)
        {
            //获取我绑定的物流列表
            sql = makesql.MakeSelectSql(typeof(Model.Model.LC_UserBindLogisticsList), "uid=@uid", new System.Data.SqlClient.SqlParameter[] {
                new System.Data.SqlClient.SqlParameter("@uid", myuservo.uid)
            });
            ids = db.Read(sql);
            if (!ids.flag)
            {
                return(new Tuple <bool, string, List <Dictionary <string, I_ModelBase> > >(false, ids.errormsg, null));
            }
            if (!ids.ReadIsOk())
            {
                return(new Tuple <bool, string, List <Dictionary <string, I_ModelBase> > >(false, "您没有绑定任何物流公司无法进行发货!", null));
            }

            var ubll_list = ids.GetVOList <Model.Model.LC_UserBindLogisticsList>();

            //两表查询
            Type[] tlist = new Type[] {
                typeof(Model.Model.LC_User),
                typeof(Model.Model.LC_Line)
            };
            sql = makesql.MakeSelectArrSql(tlist, "{0}.UID={1}.UID and {0}.UID in (" + ubll_list.Select(x => "'" + x.LogisticsUid + "'").ToList().ListToString() + ")");
            ids = db.Read(sql);
            if (!ids.flag)
            {
                return(new Tuple <bool, string, List <Dictionary <string, I_ModelBase> > >(false, ids.errormsg, null));
            }
            if (ids.ReadIsOk())
            {
                return(new Tuple <bool, string, List <Dictionary <string, I_ModelBase> > >(true, string.Empty, ids.GetVOList(tlist)));
            }
            return(new Tuple <bool, string, List <Dictionary <string, I_ModelBase> > >(true, "没有任何数据", null));
        }
Ejemplo 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 = "")
 {
     return(DAL.DAL.LC_User.Add(lC_User, loginvo, LogisticsUid));
 }
Ejemplo n.º 5
0
 public static Tuple <bool, string> Add(Model.Model.LC_Line LC_Line, GlobalBLL.UserLoginVO uservo)
 {
     return(DAL.DAL.LC_Line.Add(LC_Line, uservo));
 }