示例#1
0
        public ActionResult AddListSalesDetail(List <P_ConsumptionInfo> cilist)
        {
            CodeModels.CallBackEntity <string> cbe = new CallBackEntity <string>();
            SqlSugarClient sclient = SugarFactory.GetInstance();
            var            result  = sclient.Ado.UseTran(() =>
            {
                foreach (P_ConsumptionInfo ci in cilist)
                {
                    if (ci.Consumption_Money != null && ci.Consumption_Money != 0)
                    {
                        ci.Consumption_Code = Guid.NewGuid();
                        int count           = sclient.Insertable <P_ConsumptionInfo>(ci).ExecuteCommand();
                    }
                }
            });

            if (result.IsSuccess)
            {
                cbe.Status = 200;
                cbe.Msg    = "成功";
            }
            else
            {
                cbe.Status = 400;
                cbe.Msg    = "提交数据有误!";
            }

            return(Json(cbe));
        }
        public ActionResult Save(FormCollection f, P_CommodityType info)
        {
            int count = 0;

            if (info.Id > 0)
            {
                count = SugarFactory.GetInstance().Updateable <P_CommodityType>(info).ExecuteCommand();
            }
            else
            {
                count = SugarFactory.GetInstance().Insertable <P_CommodityType>(info).ExecuteCommand();
            }
            if (info.Id == 0)
            {
                if (count > 0)
                {
                    return(Json(TipHelper.JsonData("新增类别成功!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
                else
                {
                    return(Json(TipHelper.JsonData("新增类别失败!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
            }
            else
            {
                if (count > 0)
                {
                    return(Json(TipHelper.JsonData("更新类别成功!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
                else
                {
                    return(Json(TipHelper.JsonData("更新类别失败!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
            }
        }
        public ActionResult AjaxList(jQueryDataTableParamModel param)
        {
            ISugarQueryable <P_CommodityType> sqable = SugarFactory.GetInstance().Queryable <P_CommodityType>();

            //获取总记录数
            this.TotalRecordCount = sqable.Count();
            this.PageSize         = 15;
            int allcount = this.TotalRecordCount;
            List <P_CommodityType> CommodityAll = sqable.ToPageList(param.iDisplayStart / param.iDisplayLength + 1, this.PageSize, ref allcount);
            //转化数据格式
            var result = from m in CommodityAll
                         select new[] {
                m.Type_Code.ToString(),
                m.Type_Name,
            };

            //返回json数据
            return(Json(
                       new
            {
                sEcho = param.sEcho,
                iTotalRecords = this.TotalRecordCount,
                iTotalDisplayRecords = this.TotalRecordCount,
                aaData = result
            }
                       ));
        }
示例#4
0
        public ActionResult Login(FormCollection fc)
        {
            string account  = fc["account"].ToString();
            string password = fc["password"].ToString();

            P_User user = SugarFactory.GetInstance().Queryable <P_User>().Where(it => it.User_Accounts == account).AddJoinInfo("P_SystemRoles", "s2", "User_Roles_Code=Role_Code").Select("P_User.*,s2.Role_Name").Single();
            string pass = Encryption.GetMd5(password);

            if (user != null)
            {
                if (user.User_Pwd.Equals(Encryption.GetMd5(password)))
                {
                    ContextConfig.SetUser(user);
                    return(Content("toastr.success('登陆成功!');", "application/x-javascript"));
                }
                else
                {
                    return(Content("toastr.success('密码错误!');", "application/x-javascript"));
                }
            }
            else
            {
                return(Content("toastr.success('用户不存在!');", "application/x-javascript"));
            }
        }
示例#5
0
        public ActionResult AjaxClassMenuList(jQueryDataTableParamModel param)
        {
            //获取总记录数
            this.TotalRecordCount = SugarFactory.GetInstance().Ado.GetInt("select Count(*) from P_SystemMenu");;
            this.PageSize         = 15;
            int allcount = this.TotalRecordCount;
            List <P_SystemMenu> menuAll = SugarFactory.GetInstance().Queryable <P_SystemMenu>().OrderBy(it => it.Menu_Id, SqlSugar.OrderByType.Asc).ToPageList(param.iDisplayStart / param.iDisplayLength + 1, this.PageSize, ref allcount);



            //转化数据格式
            var result = from m in menuAll
                         select new[] {
                m.Menu_Code.ToString(),
                m.Menu_Name,
                m.Menu_Image,
                m.Menu_Url,
                m.Menu_Order.ToString()
            };

            //返回json数据
            return(Json(
                       new
            {
                sEcho = param.sEcho,
                iTotalRecords = this.TotalRecordCount,
                iTotalDisplayRecords = this.TotalRecordCount,
                aaData = result
            }
                       ));
        }
示例#6
0
 public ActionResult AddSalesDetail(P_ConsumptionInfo ci)
 {
     CodeModels.CallBackEntity <string> cbe = new CallBackEntity <string>();
     if (ci.Consumption_Money != null && ci.Consumption_Money != 0)
     {
         ci.Consumption_Code = Guid.NewGuid();
         int count = SugarFactory.GetInstance().Insertable <P_ConsumptionInfo>(ci).ExecuteCommand();
         if (count > 0)
         {
             cbe.Status = 200;
             cbe.Msg    = "成功";
         }
         else
         {
             cbe.Status = 400;
             cbe.Msg    = "失败";
         }
     }
     else
     {
         cbe.Status = 400;
         cbe.Msg    = "金额不能为空";
     }
     return(Json(cbe));
 }
示例#7
0
 public User FirstOrDefault(Expression <Func <User, bool> > predicate)
 {
     using (var db = SugarFactory.GetInstance())
     {
         // select single
         var single = db.Queryable <User>().Single(predicate);
         return(single);
     }
 }
示例#8
0
 public User Insert(User entity)
 {
     using (var db = SugarFactory.GetInstance())
     {
         // insert item
         db.Insert(entity);
         return(entity);
     }
 }
示例#9
0
 public bool IsExist(Expression <Func <User, bool> > predicate)
 {
     using (var db = SugarFactory.GetInstance())
     {
         // is any
         bool isAny = db.Queryable <User>().Any(predicate);
         return(isAny);
     }
 }
示例#10
0
 public User Update(User entity)
 {
     using (var db = SugarFactory.GetInstance())
     {
         // update by entity
         db.Update(entity);
         return(entity);
     }
 }
示例#11
0
        public void Init()
        {
            Console.WriteLine("启动MappingColumns.Init");

            //全局设置
            using (var db = SugarFactory.GetInstance())
            {
                var list = db.Queryable <Student>().Where(it => it.classId == 1).ToList();
            }
        }
示例#12
0
        public ActionResult AjaxList(jQueryDataTableParamModel param)
        {
            //条件
            string isExecutedSearch = Request.Params.Get("isExecutedSearch");

            string where = " 1=1 ";
            if (isExecutedSearch != null && isExecutedSearch == "1")
            {
                if (!String.IsNullOrEmpty(Request.Params.Get("searchtype")))
                {
                    if (Request.Params.Get("searchtype").Trim() != "")
                    {
                        where += "and Commodity_TypeCode='" + Request.Params.Get("searchtype").Trim() + "'";
                    }
                }
                if (!String.IsNullOrEmpty(Request.Params.Get("searchparam")))
                {
                    if (Request.Params.Get("searchparam").Trim() != "")
                    {
                        where += "and Commodity_Name like '%" + Request.Params.Get("searchparam").Trim() + "%' or BarCode like '%" + Request.Params.Get("searchparam").Trim() + "%'";
                    }
                }
            }
            //获取总记录数
            this.TotalRecordCount = SugarFactory.GetInstance().Ado.GetInt("select Count(*) from P_CommodityInfo where" + where);
            this.PageSize         = 15;
            int allcount = this.TotalRecordCount;
            List <P_CommodityInfo> CommodityAll = SugarFactory.GetInstance().Queryable <P_CommodityInfo>().AddJoinInfo("P_CommodityType", "s2", "Commodity_TypeCode = s2.Type_Code").Select("P_CommodityInfo.*,s2.Type_Name").WhereIF(true, where).ToPageList(param.iDisplayStart / param.iDisplayLength + 1, this.PageSize, ref allcount);
            //转化数据格式
            var result = from m in CommodityAll
                         select new[] {
                m.Commodity_Code.ToString(),
                m.Commodity_Name,
                m.BarCode,
                m.Type_Name,
                m.PCSalePrice.Value.ToString(),
                m.RetailPrice.Value.ToString(),
                m.Specification,
                m.Commodity_Unit
            };

            //返回json数据
            return(Json(
                       new
            {
                sEcho = param.sEcho,
                iTotalRecords = this.TotalRecordCount,
                iTotalDisplayRecords = this.TotalRecordCount,
                aaData = result
            }
                       ));
        }
示例#13
0
        public ActionResult AjaxUserList(jQueryDataTableParamModel param)
        {
            //条件
            string isExecutedSearch = Request.Params.Get("isExecutedSearch");

            string where = " 1=1 ";
            if (isExecutedSearch != null && isExecutedSearch == "1")
            {
                if (!String.IsNullOrEmpty(Request.Params.Get("searchMname")))
                {
                    if (Request.Params.Get("searchMname").Trim() != "")
                    {
                        where += "and P_User.Merchant_Code='" + Request.Params.Get("searchMname").Trim() + "'";
                    }
                }
                if (!String.IsNullOrEmpty(Request.Params.Get("searchparam")))
                {
                    if (Request.Params.Get("searchparam").Trim() != "")
                    {
                        where += "and User_Accounts like '%" + Request.Params.Get("searchparam").Trim() + "%' or User_Name like '%" + Request.Params.Get("searchparam").Trim() + "%' or User_Phone like '%" + Request.Params.Get("searchparam").Trim() + "%'";
                    }
                }
            }
            //获取总记录数
            this.TotalRecordCount = SugarFactory.GetInstance().Ado.GetInt("select Count(*) from P_User where" + where);
            this.PageSize         = 5;
            int           allcount = this.TotalRecordCount;
            List <P_User> UserAll  = SugarFactory.GetInstance().Queryable <P_User>().AddJoinInfo("P_MerchantInfo", "s2", "P_User.Merchant_Code = s2.Merchant_Code").AddJoinInfo("P_SystemRoles", "s3", "User_Roles_Code=s3.Role_Code").Select("P_User.*,s2.Merchant_Name,s3.Role_Name").WhereIF(true, where).ToPageList(param.iDisplayStart / param.iDisplayLength + 1, this.PageSize, ref allcount);
            //转化数据格式
            var result = from m in UserAll
                         select new[] {
                m.User_Code.ToString(),
                m.User_Accounts,
                m.User_Name,
                m.User_Sex,
                m.User_Phone,
                m.User_Address,
                m.Merchant_Name,
                m.Role_Name
            };

            //返回json数据
            return(Json(
                       new
            {
                sEcho = param.sEcho,
                iTotalRecords = this.TotalRecordCount,
                iTotalDisplayRecords = this.TotalRecordCount,
                aaData = result
            }
                       ));
        }
示例#14
0
        public ActionResult DeleteMerchantInfo(string code)
        {
            int rcount = SugarFactory.GetInstance().Deleteable <P_MerchantInfo>().Where(it => it.Merchant_Code == Guid.Parse(code)).ExecuteCommand();

            if (rcount > 0)
            {
                return(Json(TipHelper.JsonData("删除成功!", "", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.RefreshThisPage)));;
            }
            else
            {
                return(Json(TipHelper.JsonData("删除失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction)));
            }
        }
示例#15
0
 public ActionResult AddType(string code)
 {
     AdminPanel.CodeModels.P_CommodityType CommInfo = new P_CommodityType();
     if (!String.IsNullOrEmpty(code))
     {
         CommInfo = SugarFactory.GetInstance().Queryable <P_CommodityType>().InSingle(code);
     }
     else
     {
         CommInfo.Type_Code = Guid.NewGuid();
         //CommInfo.Creator = ContextConfig.GetUser().User_Code.ToString();
         CommInfo.Creator       = "admin";
         CommInfo.Creation_Time = DateTime.Now;
     }
     return(View(CommInfo));
 }
示例#16
0
        public ActionResult SaveRoles(FormCollection f, P_SystemRoles info)
        {
            int count = 0;

            if (info.Role_Id > 0)
            {
                count = SugarFactory.GetInstance().Updateable <P_SystemRoles>(info).ExecuteCommand();
            }
            else
            {
                count = SugarFactory.GetInstance().Insertable <P_SystemRoles>(info).ExecuteCommand();
            }
            SugarFactory.GetInstance().Deleteable <P_RolesToMenu>().Where(it => it.RTM_Roles_Code == info.Role_Code).ExecuteCommand();
            if (!String.IsNullOrEmpty(info.MenuCodes))
            {
                string[] strs = info.MenuCodes.TrimEnd(',').Split(',');
                foreach (string item in strs)
                {
                    P_RolesToMenu rtm = new P_RolesToMenu();
                    rtm.RTM_Menu_Code  = Guid.Parse(item);
                    rtm.RTM_Roles_Code = info.Role_Code;
                    SugarFactory.GetInstance().Insertable <P_RolesToMenu>(rtm).ExecuteCommand();
                }
            }
            if (info.Role_Id == 0)
            {
                if (count > 0)
                {
                    return(Json(TipHelper.JsonData("新增角色成功!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
                else
                {
                    return(Json(TipHelper.JsonData("新增角色失败!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
            }
            else
            {
                if (count > 0)
                {
                    return(Json(TipHelper.JsonData("更新角色成功!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
                else
                {
                    return(Json(TipHelper.JsonData("更新角色失败!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
            }
        }
示例#17
0
        public ActionResult Save(FormCollection fc, P_User cm)
        {
            int rcount = 0;

            if (!String.IsNullOrEmpty(cm.User_Pwd))
            {
                cm.User_Pwd = Encryption.GetMd5(cm.User_Pwd);
            }
            else
            {
                P_User pu = SugarFactory.GetInstance().Queryable <P_User>().InSingle(cm.User_Code);
                cm.User_Pwd = pu.User_Pwd;
            }
            if (Convert.ToInt32(fc["Id"]) > 0)
            {
                rcount = SugarFactory.GetInstance().Updateable <P_User>(cm).ExecuteCommand();
            }
            else
            {
                rcount = SugarFactory.GetInstance().Insertable <P_User>(cm).ExecuteCommand();
            }
            string formOperateType = fc["formOperateType"].ToString().ToLower();

            if (formOperateType == "saveandnewnext")
            {
                if (rcount > 0)
                {
                    return(Json(TipHelper.JsonData("新增用户信息成功", "", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.RefreshThisPage)));
                }
                else
                {
                    return(Json(TipHelper.JsonData("新增用户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction)));
                }
            }
            else
            {
                if (rcount > 0)
                {
                    return(Json(TipHelper.JsonData("保存用户信息成功!", "/UserInfo/UserList", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.ThisPageGoAnotherPage)));
                }
                else
                {
                    //表单提交失败固定写法
                    return(Json(TipHelper.JsonData("保存用户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction)));
                }
            }
        }
示例#18
0
 public ActionResult AddSalesDetail(P_ConsumptionInfo ci)
 {
     if (ci.Consumption_Money != null && ci.Consumption_Money != 0)
     {
         ci.Consumption_Code = Guid.NewGuid();
         int count = SugarFactory.GetInstance().Insertable <P_ConsumptionInfo>(ci).ExecuteCommand();
         if (count > 0)
         {
             Content("success");
         }
         else
         {
             Content("faile");
         }
     }
     return(Content(""));
 }
        public void Init(DbType type)
        {
            Console.WriteLine("启动MappingTable.Init");

            //单个设置
            using (var db = SugarDao.GetInstance(type))
            {
                var list = db.Queryable <V_Student>("Student").ToList();//查询的是 select * from student 而我的实体名称为V_Student
            }


            //全局设置
            using (var db = SugarFactory.GetInstance(type))
            {
                var list = db.Queryable <V_Student>().ToList();//查询的是 select * from student 而我的实体名称为V_Student
            }
        }
示例#20
0
 public ActionResult CreateMerchantInfo(string code, string type)
 {
     AdminPanel.CodeModels.P_MerchantInfo CommInfo = new P_MerchantInfo();
     if (code != null)
     {
         CommInfo = SugarFactory.GetInstance().Queryable <P_MerchantInfo>().InSingle(code);
     }
     else
     {
         CommInfo.Merchant_Code = Guid.NewGuid();
         //CommInfo.Creator = ContextConfig.GetUser().User_Code.ToString();
         CommInfo.Creator       = "admin";
         CommInfo.Creation_Time = DateTime.Now;
     }
     ViewBag.type = type;
     return(View(CommInfo));
 }
示例#21
0
        public ActionResult AddRoles(string code)
        {
            ISugarQueryable <P_SystemMenu> sql = SugarFactory.GetInstance().Queryable <P_SystemMenu>().Where(it => it.Menu_Parent != 0).OrderBy(it => it.Menu_Id, SqlSugar.OrderByType.Asc);

            P_SystemRoles sr = new P_SystemRoles();

            if (String.IsNullOrEmpty(code))
            {
                ViewBag.MenuList = sql.ToList();
            }
            else
            {
                sr = SugarFactory.GetInstance().Queryable <P_SystemRoles>().Where(it => it.Role_Code == Guid.Parse(code)).Single();
                List <P_SystemMenu> menulist = sql.AddJoinInfo("P_RolesToMenu", "rm", "rm.RTM_Menu_Code=Menu_Code and rm.RTM_Roles_Code='" + code + "'", JoinType.Left).Select("P_SystemMenu.*,RTM_Id").ToList();
                ViewBag.MenuList = menulist;
            }
            return(View(sr));
        }
示例#22
0
        public void Init()
        {
            Console.WriteLine("启动SerialNumber.Init");
            using (SqlSugarClient db = SugarFactory.GetInstance())//开启数据库连接
            {
                var dientityValue = db.Insert <StudentEntity>(new StudentEntity()
                {
                });
                var name = db.Queryable <StudentEntity>().Single(it => it.id == dientityValue.ObjToInt()).name;
                Console.WriteLine(name);

                var dientityValue2 = db.Insert <School>(new School()
                {
                });
                var name2 = db.Queryable <School>().Single(it => it.id == dientityValue2.ObjToInt()).name;
                Console.WriteLine(name2);;
            }
        }
示例#23
0
        public ActionResult AddMerchantInfo(AdminPanel.CodeModels.P_MerchantInfo cm)
        {
            CodeModels.CallBackEntity <string> cbe = new CallBackEntity <string>();
            cm.Merchant_Code = Guid.NewGuid();
            int rcount = SugarFactory.GetInstance().Insertable <P_MerchantInfo>(cm).ExecuteCommand();

            if (rcount > 0)
            {
                cbe.Status = 200;
                cbe.Data   = cm.Merchant_Code.ToString();
                cbe.Msg    = "成功";
            }
            else
            {
                cbe.Status = 400;
                cbe.Msg    = "失败";
            }
            return(Json(cbe));
        }
示例#24
0
        public ActionResult AddMenu(string code)
        {
            P_SystemMenu sm = new P_SystemMenu();

            if (String.IsNullOrEmpty(code))
            {
                sm.Menu_Createtime = DateTime.Now;
                sm.Menu_Creator    = "admin";
                sm.Menu_Code       = Guid.NewGuid();
            }
            else
            {
                sm = SugarFactory.GetInstance().Queryable <P_SystemMenu>().Where(tb => tb.Menu_Code == Guid.Parse(code)).Single();
            }
            ViewBag.ParentList = SugarFactory.GetInstance().Queryable <P_SystemMenu>().Where(it => it.Menu_Parent == 0).ToList();


            return(View(sm));
        }
示例#25
0
        public ActionResult AjaxList(jQueryDataTableParamModel param)
        {
            //条件
            string isExecutedSearch = Request.Params.Get("isExecutedSearch");

            string where = " 1=1 ";
            if (isExecutedSearch != null && isExecutedSearch == "1")
            {
                if (!String.IsNullOrEmpty(Request.Params.Get("searchparam")))
                {
                    if (Request.Params.Get("searchparam").Trim() != "")
                    {
                        where += "and Merchant_Name like '%" + Request.Params.Get("searchparam").Trim() + "%' or SevenCents_Code like '%" + Request.Params.Get("searchparam").Trim() + "%' or Merchant_Phone like '%" + Request.Params.Get("searchparam").Trim() + "%'";
                    }
                }
            }
            //获取总记录数
            this.TotalRecordCount = SugarFactory.GetInstance().Ado.GetInt("select Count(*) from P_MerchantInfo where" + where);
            this.PageSize         = 5;
            int allcount = this.TotalRecordCount;
            List <P_MerchantInfo> CommodityAll = SugarFactory.GetInstance().Queryable <P_MerchantInfo>().WhereIF(true, where).ToPageList(param.iDisplayStart / param.iDisplayLength + 1, this.PageSize, ref allcount);
            //转化数据格式
            var result = from m in CommodityAll
                         select new[] {
                m.Merchant_Code.ToString(),
                m.Merchant_Name,
                m.Ipay_Code,
                m.Merchant_Phone,
                m.Merchant_Address
            };

            //返回json数据
            return(Json(
                       new
            {
                sEcho = param.sEcho,
                iTotalRecords = this.TotalRecordCount,
                iTotalDisplayRecords = this.TotalRecordCount,
                aaData = result
            }
                       ));
        }
示例#26
0
        public ActionResult AddUser(string code, string type)
        {
            ViewBag.MerchantInfo = SugarFactory.GetInstance().Queryable <P_MerchantInfo>().ToList();
            ViewBag.SystemRoles  = SugarFactory.GetInstance().Queryable <P_SystemRoles>().ToList();
            P_User CommInfo = new P_User();

            if (code != null)
            {
                CommInfo          = SugarFactory.GetInstance().Queryable <P_User>().InSingle(Guid.Parse(code));
                CommInfo.User_Pwd = "";
            }
            else
            {
                CommInfo.User_Code = Guid.NewGuid();
                //CommInfo.Creator = ContextConfig.GetUser().User_Code.ToString();
                CommInfo.Creator       = "admin";
                CommInfo.Creation_Time = DateTime.Now;
            }
            ViewBag.type = type;
            return(View(CommInfo));
        }
示例#27
0
        public ActionResult Save(FormCollection fc, AdminPanel.CodeModels.P_MerchantInfo cm)
        {
            int rcount = 0;

            if (Convert.ToInt32(fc["Id"]) > 0)
            {
                rcount = SugarFactory.GetInstance().Updateable <P_MerchantInfo>(cm).ExecuteCommand();
            }
            else
            {
                rcount = SugarFactory.GetInstance().Insertable <P_MerchantInfo>(cm).ExecuteCommand();
            }
            string formOperateType = fc["formOperateType"].ToString().ToLower();

            if (formOperateType == "saveandnewnext")
            {
                if (rcount > 0)
                {
                    return(Json(TipHelper.JsonData("新增商户信息成功", "", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.RefreshThisPage)));
                }
                else
                {
                    return(Json(TipHelper.JsonData("新增商户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction)));
                }
            }
            else
            {
                if (rcount > 0)
                {
                    return(Json(TipHelper.JsonData("保存商户信息成功!", "/MerchantInfo/MerchantInfoList", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.ThisPageGoAnotherPage)));
                }
                else
                {
                    //表单提交失败固定写法
                    return(Json(TipHelper.JsonData("保存商户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction)));
                }
            }
        }
示例#28
0
        public ActionResult Left()
        {
            //ISugarQueryable<P_SystemMenu> sql = SugarFactory.GetInstance().Queryable<P_SystemMenu>().OrderBy(sm => sm.Menu_Id, OrderByType.Asc);
            //List<P_SystemMenu> menuAll2=sql.ToList();
            ISugarQueryable <P_SystemMenu> sql     = SugarFactory.GetInstance().Queryable <P_SystemMenu>().AddJoinInfo("P_RolesToMenu", "s2", "Menu_code=RTM_Menu_code and RTM_Roles_Code='" + ContextConfig.GetUser().User_Roles_Code + "'", JoinType.Inner).Select("P_SystemMenu.*").OrderBy("Menu_id asc");
            List <P_SystemMenu>            menuAll = sql.ToList();

            ArrayList list = new ArrayList();

            foreach (P_SystemMenu item in menuAll)
            {
                if (!list.Contains(item.Menu_Parent + ""))
                {
                    list.Add(item.Menu_Parent + "");
                }
            }

            string[]            strs     = (string[])list.ToArray(typeof(string));
            List <P_SystemMenu> menuAll2 = SugarFactory.GetInstance().Queryable <P_SystemMenu>().In(it => it.Menu_Id, strs).OrderBy(sm => sm.Menu_Id, OrderByType.Asc).ToList();

            menuAll.AddRange(menuAll2);
            ViewBag.LeftMenuTree = LeftMenuTree(menuAll);
            return(View());
        }
示例#29
0
        public void Init()
        {
            Console.WriteLine("启动MappingTable.Init");

            //单个设置
            using (var db = SugarDao.GetInstance())
            {
                var list = db.Queryable <V_Student>("Student").ToList();//查询的是 select * from student 而我的实体名称为V_Student
            }


            //全局设置
            using (var db = SugarFactory.GetInstance())
            {
                var list = db.Queryable <V_Student>().ToList();//查询的是 select * from student 而我的实体名称为V_Student


                db.SetMappingTables(null);//清空
                db.AddMappingTable(new KeyValue()
                {
                    Key = "", Value = ""
                });
            }
        }
示例#30
0
        public void MysqlSugarTest()
        {
            using (var db = SugarFactory.GetInstance())
            {
                Console.WriteLine("生成时间:" + DateTime.Now.ToLongTimeString());
                var list = new List <Model.SugarDemo>();
                for (var i = 0; i < 10000; i++)
                {
                    list.Add(new Model.SugarDemo()
                    {
                        Id   = Guid.NewGuid().ToString("N"),
                        Name = "江雄" + i,
                        Num  = i,
                    });

                    if (list.Count >= 100)
                    {
                        db.SqlBulkCopy(list);
                        list.Clear();
                    }
                }

                Console.WriteLine("开始时间:" + DateTime.Now.ToLongTimeString());


                if (list.Count >= 0)
                {
                    db.SqlBulkCopy(list);
                    list.Clear();
                }

                Console.WriteLine("结束时间:" + DateTime.Now.ToLongTimeString());

                Console.ReadKey();
            }
        }