Exemple #1
0
 public int Save(Fgroup fg)
 {
     fg.Replace4MySQL();
     if (fg.rowid == 0)
     {
         if (_access.getDataTable(string.Format("select rowid from t_fgroup where (groupname='{0}' or groupcode='{1}')", fg.groupName, fg.groupCode)).Rows.Count > 0)
         {
             return -1;//群組名稱或群組編碼已存在
         }
         else
         {
             _access.execCommand(string.Format("insert into t_fgroup(groupname,groupcode,remark,kuser,kdate) values('{0}','{1}','{2}','{3}',now())", fg.groupName, fg.groupCode, fg.remark, fg.kuser));
             return 1;//新增成功
         }
     }
     else
     {
         if (_access.getDataTable(string.Format("select rowid from t_fgroup where (groupname='{1}' or groupcode='{2}') and rowid <> {0}", fg.rowid, fg.groupName, fg.groupCode)).Rows.Count > 0)
         {
             return -1;//群組名稱或群組編碼已存在
         }
         else
         {
             _access.execCommand(string.Format("update t_fgroup set groupname='{1}',groupcode='{2}',remark='{3}' where rowid={0}", fg.rowid, fg.groupName, fg.groupCode, fg.remark));
             return 2;//修改成功
         }
     }
 }
Exemple #2
0
        public int Delete(Fgroup fg)
        {
            fg.Replace4MySQL();
            SqlParameter[] paras = new SqlParameter[]{
                new SqlParameter("@rowid",fg.rowid)
            };

            return _access.execCommand("sp_Fgroup_Delete_xuanzi0404h", paras);
        }
Exemple #3
0
 public int Delete(Fgroup fg)
 {
     try
     {
         return _fgDao.Delete(fg);
     }
     catch (Exception ex)
     {
         throw new Exception("FgroupMgr-->Delete-->" + ex.Message, ex);
     }
     
 }
Exemple #4
0
        public int Delete(Fgroup fg)
        {
            fg.Replace4MySQL();
            strSql = string.Format(@"delete from t_groupcaller where groupid={0}", fg.rowid);
            _access.execCommand(strSql);

            strSql = string.Format(@"delete from t_functiongroup where groupid={0}", fg.rowid);
            _access.execCommand(strSql);

            strSql = string.Format(@"delete from t_fgroup where rowid={0}", fg.rowid);
            _access.execCommand(strSql);
            return 1;
        }
Exemple #5
0
        public int Save(Fgroup fg)
        {
            fg.Replace4MySQL();
            SqlParameter[] paras = new SqlParameter[6];
            paras[0] = new SqlParameter("@rowid", fg.rowid);
            paras[1] = new SqlParameter("@groupName", fg.groupName);
            paras[2] = new SqlParameter("@groupCode", fg.groupCode);
            paras[3] = new SqlParameter("@remark", fg.remark);
            paras[4] = new SqlParameter("@kuser", fg.kuser);
            paras[5] = new SqlParameter();
            paras[5].Direction = ParameterDirection.ReturnValue;

            _access.execCommand("sp_Fgroup_Save_xuanzi0404h", paras);
            return Int32.Parse(paras[5].Value.ToString());
        }
Exemple #6
0
 public Fgroup GetSingle(Fgroup model) //add by mengjuan0826j 獲取單個model  根據groupname和groupcode 
 {
     throw new NotImplementedException();
 }
        public string QueryPm()
        {
            gcMgr = new GroupCallerMgr(connectionString);
            paraMgr = new ParameterMgr(connectionString);
            fgMgr = new FgroupMgr(connectionString);
            muMgr = new ManageUserMgr(connectionString);
            groupCaller gc = new groupCaller();
            Fgroup fg = new Fgroup();
            string json = string.Empty;

            try
            {
                List<Parametersrc> parstore = paraMgr.QueryUsed(new Parametersrc { ParameterType = "vendor_pm" }).ToList();

                if (parstore.Count != 0)
                {
                    fg.groupCode = parstore[0].ParameterCode;
                    //  fg.groupName = parstore[0].parameterName;//parameterName是可變的不可依此查詢 edit by shuangshuang0420j 2015.07.28 09:48
                    Fgroup pmfg = fgMgr.GetSingle(fg);
                    if (pmfg != null)
                    {
                        gc.groupId = pmfg.rowid;
                        string pm = gcMgr.QueryCallidById(gc);
                        StringBuilder stb = new StringBuilder("");
                        stb.Append("{");
                        stb.Append("success:true,item:[");
                        //stb.Append("{");
                        //stb.AppendFormat("\"userId\":\"{0}\",\"userName\":\"{1}\"", 0, "請選擇");
                        //stb.Append("}");
                        string nameStr = string.Empty;

                        string[] pmar = pm.Split(',').ToArray();
                        foreach (var item in pmar)
                        {
                            int total = 0;
                            ManageUserQuery mu = muMgr.GetManageUserList(new ManageUserQuery { user_email = item, search_status = "-1" }, out total).FirstOrDefault();
                            if (total == 1 && mu != null)
                            {
                                stb.Append("{");
                                stb.AppendFormat("\"userId\":\"{0}\",\"userName\":\"{1}\"", mu.user_id, mu.user_username);
                                stb.Append("}");
                            }
                        }
                        stb.Append("]}");
                        json = stb.ToString().Replace("}{", "},{");
                    }
                    //else
                    //{
                    //    json = "{success:false,error:1}";
                    //}
                }
                //else
                //{
                //    json = "{success:false,error:0}";
                //}
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "[]";
            }

            return json;

        }
Exemple #8
0
 public Fgroup GetSingle(Fgroup model)
 {
     try
     {
         return _fgDao.GetSingle(model);
     }
     catch (Exception ex)
     {
         throw new Exception("FgroupMgr-->GetSingle-->" + ex.Message, ex);
     }
 }
Exemple #9
0
 public Fgroup GetSingle(Fgroup model)//add by mengjuan0826j 獲取單個model  根據groupname和groupcode 
 {
     model.Replace4MySQL();
     StringBuilder strSql = new StringBuilder();
     try
     {
         strSql.Append("select rowid,groupName,groupCode,remark,kuser,kdate ");
         strSql.Append(" from t_fgroup ");
         strSql.Append(" where 1=1 ");
         //if (!string.IsNullOrEmpty(model.groupName))
         //{
         //    strSql.AppendFormat(" and groupName='{0}'", model.groupName);
         //}
         if (!string.IsNullOrEmpty(model.groupCode))
         {
             strSql.AppendFormat(" and groupCode='{0}'", model.groupCode);
         }
         return _access.getSinggleObj<Fgroup>(strSql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception(" FgroupDao-->GetSingle-->" + ex.Message + strSql.ToString(), ex);
     }
 }