Esempio n. 1
0
        public string QueryCallid()
        {

            fgMgr = new FgroupMgr(mySqlConnectionString);

            string json = string.Empty;

            try
            {
                json = fgMgr.QueryCallid();
            }
            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;
        }
Esempio n. 2
0
        public HttpResponseBase QueryProduct()
        {
            string json = "{success:true,data:[]}";
            try
            {
                Product product = null;
                Caller caller = Session["caller"] as Caller;
                if (!string.IsNullOrEmpty(Request.Form["ProductId"]))
                {
                    uint product_id = 0;
                    if (uint.TryParse(Request.Form["ProductId"], out product_id))
                    {
                        _productMgr = new ProductMgr(connectionString);
                        product = _productMgr.Query(new Product { Product_Id = product_id }).FirstOrDefault();
                        if (product.Product_alt == "")
                        {
                            product.Product_alt = product.Product_Name;
                        }//add by wwei0216w 2015/4/15 //如果商品說明為空則將商品名稱賦予product_alt
                    }
                }
                else//查詢temp表
                {
                    _productTempMgr = new ProductTempMgr(connectionString);
                    int writerId = caller.user_id;
                    ProductTemp query = new ProductTemp { Writer_Id = writerId, Combo_Type = COMBO_TYPE };
                    if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                    {
                        query.Product_Id = Request.Form["OldProductId"];
                    }
                    product = _productTempMgr.GetProTemp(query);
                    if (product.Product_alt == "")
                    {
                        product.Product_alt = product.Product_Name;
                    }//add by wwei0216w 2015/4/15 //如果商品說明為空則將商品名稱賦予product_alt
                }
                if (product != null)
                {
                    if (!string.IsNullOrEmpty(product.Product_Image))
                    {
                        product.Product_Image = imgServerPath + prodPath + GetDetailFolder(product.Product_Image) + product.Product_Image;
                    }
                    else
                    {
                        product.Product_Image = imgServerPath + "/product/nopic_150.jpg";
                    }
                    if (!string.IsNullOrEmpty(product.Mobile_Image)) //edit by wwei0216w 2015/3/18 添加關於手機說明圖的操作
                    {
                        prodPath = prodMobile640; //add by wwei0216w 2015/4/1 添加原因:手機圖片要放在640*640路徑下
                        product.Mobile_Image = imgServerPath + prodPath + GetDetailFolder(product.Mobile_Image) + product.Mobile_Image;
                    }
                    else
                    {
                        product.Mobile_Image = imgServerPath + "/product/nopic_150.jpg";
                        //product.Mobile_Image = imgServerPath + "/Content/img/click_up_img.jpg";
                    }
                    #region 庫存是否可編輯
                    //edit by xiangwang 0413w 2014/10/09
                    if (Request.UrlReferrer.AbsolutePath == "/Product/productStock")
                    {
                        IFgroupImplMgr _fgroupMgr = new FgroupMgr(connectionString);
                        product.IsEdit = _fgroupMgr.QueryStockPrerogative(caller.user_email, Server.MapPath(xmlPath));

                        //if (caller.user_email == "*****@*****.**" || caller.user_email == "*****@*****.**")
                        //{
                        //    product.IsEdit = true;
                        //}



                    }
                    #endregion
                }
                json = "{success:true,data:" + JsonConvert.SerializeObject(product) + "}";
            }
            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 = "[]";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Esempio n. 3
0
 public int GetVebdorPMGroup()//add by mengjuan0826j 2015/6/8 處理供應商pm設定
 {
     paraMgr = new ParameterMgr(mySqlConnectionString);
     fgMgr = new FgroupMgr(mySqlConnectionString);
     List<Parametersrc> parstore = paraMgr.QueryUsed(new Parametersrc { ParameterType = "vendor_pm" }).ToList();//獲取vendor_pm 群組的設定  群組名稱和群組編碼
     int group_id = 0;
     if (parstore.Count != 0)
     {
         fg.groupCode = parstore[0].ParameterCode;
         fg.groupName = parstore[0].parameterName;
         Fgroup pmfg = fgMgr.GetSingle(fg);//根據群組名稱找到group_id
         if (pmfg != null)
         {
             group_id = pmfg.rowid;
         }
     }
     return group_id;
 }
Esempio n. 4
0
        public void ExportGroupLimit()
        {
            try
            {
                fgMgr = new FgroupMgr(mySqlConnectionString);
                List<string> NameList = new List<string>();
                List<DataTable> Elist = new List<DataTable>();
                List<bool> comName = new List<bool>();
                DataTable _dt = fgMgr.GetFgroupList();
                for (int i = 0; i < _dt.Rows.Count; i++)//循環各個群組
                {
                    DataTable _dtone = new DataTable();
                    _dtone.Columns.Add("群組人員", typeof(String));
                    _dtone.Columns.Add("功能模塊", typeof(String));
                    _dtone.Columns.Add("基本功能", typeof(String));
                    _dtone.Columns.Add("功能操作", typeof(String));
                    #region 獲取信息
                    //獲取某個群組下的所有用戶
                    DataTable _dtUsers = fgMgr.GetUsersByGroupId(Convert.ToInt32(_dt.Rows[i]["rowid"]));
                    //獲取某個群組下的所有權限
                    DataTable _dtAuthorty = fgMgr.GetAuthorityByGroupId(Convert.ToInt32(_dt.Rows[i]["rowid"]));
                    int usercount = _dtUsers.Rows.Count;
                    int authorty = _dtAuthorty.Rows.Count;
                    if (authorty >= usercount)//如果權限的行數大於群組中的個數
                    {
                        for (int z = 0; z < _dtAuthorty.Rows.Count; z++)
                        {
                            DataRow _tbRow = _dtone.NewRow();
                            try
                            {
                                _tbRow[0] = _dtUsers.Rows[z]["user_username"].ToString().Trim();
                            }
                            catch (Exception ex)
                            {
                                _tbRow[0] = "";
                            }
                            if (z == 0)
                            {
                                thispname = _dtAuthorty.Rows[0]["pname"].ToString();
                                thiscname = _dtAuthorty.Rows[0]["cname"].ToString();
                                //_tbRow[1] = _dtAuthorty.Rows[z]["pname"] + " " + (_dtAuthorty.Rows[z]["tpname"].ToString() == "" ? "X" : "O");
                                _tbRow[1] = _dtAuthorty.Rows[z]["pname"];
                                _tbRow[2] = _dtAuthorty.Rows[z]["cname"] + " " + (_dtAuthorty.Rows[z]["tcname"].ToString() == "" ? "X" : "O");
                            }
                            else
                            {
                                if (thispname == _dtAuthorty.Rows[z]["pname"].ToString())//如果相同
                                {
                                    _tbRow[1] = "";
                                }
                                else
                                {
                                    //_tbRow[1] = _dtAuthorty.Rows[z]["pname"] + " " + (_dtAuthorty.Rows[z]["tpname"].ToString() == "" ? "X" : "O");
                                    _tbRow[1] = _dtAuthorty.Rows[z]["pname"];
                                    thispname = _dtAuthorty.Rows[z]["pname"].ToString();
                                }
                                if (thiscname == _dtAuthorty.Rows[z]["cname"].ToString())
                                {
                                    _tbRow[2] = "";
                                }
                                else
                                {
                                    _tbRow[2] = _dtAuthorty.Rows[z]["cname"] + " " + (_dtAuthorty.Rows[z]["tcname"].ToString() == "" ? "X" : "O");
                                    thiscname = _dtAuthorty.Rows[z]["cname"].ToString();
                                }
                            }
                            if (_dtAuthorty.Rows[z]["tname"].ToString() == "")
                            {
                                _tbRow[3] = "";
                            }
                            else
                            {
                                if (_dtAuthorty.Rows[z]["ttname"].ToString() == "" || _dtAuthorty.Rows[z]["functionId"].ToString() == "")
                                {
                                    _tbRow[3] = _dtAuthorty.Rows[z]["tname"] + " " + "X";
                                }
                                else
                                {
                                    _tbRow[3] = _dtAuthorty.Rows[z]["tname"] + " " + "O";
                                }
                            }
                            _dtone.Rows.Add(_tbRow);

                        }
                    }
                    else
                    {
                        for (int j = 0; j < _dtUsers.Rows.Count; j++)
                        {
                            DataRow _tbRow = _dtone.NewRow();
                            _tbRow[0] = _dtUsers.Rows[j]["user_username"].ToString().Trim();
                            if (j == 0)
                            {
                                thispname = _dtAuthorty.Rows[0]["pname"].ToString();
                                thiscname = _dtAuthorty.Rows[0]["cname"].ToString();
                                //_tbRow[1] = _dtAuthorty.Rows[0]["pname"] + " " + (_dtAuthorty.Rows[j]["tpname"].ToString() == "" ? "X" : "O");
                                _tbRow[1] = _dtAuthorty.Rows[0]["pname"];
                                _tbRow[2] = _dtAuthorty.Rows[0]["cname"] + " " + (_dtAuthorty.Rows[j]["tcname"].ToString() == "" ? "X" : "O");
                                if (_dtAuthorty.Rows[0]["tname"].ToString() == "")
                                {
                                    _tbRow[3] = "";
                                }
                                else
                                {
                                    if (_dtAuthorty.Rows[0]["ttname"].ToString() == "" || _dtAuthorty.Rows[0]["functionId"].ToString() == "")
                                    {
                                        _tbRow[3] = _dtAuthorty.Rows[0]["tname"] + " " + "X";
                                    }
                                    else
                                    {
                                        _tbRow[3] = _dtAuthorty.Rows[0]["tname"] + " " + "O";
                                    }
                                }
                            }
                            else
                            {
                                try
                                {
                                    if (thispname == _dtAuthorty.Rows[j]["pname"].ToString())
                                    {
                                        _tbRow[1] = "";
                                    }
                                    else
                                    {
                                        // _tbRow[1] = _dtAuthorty.Rows[j]["pname"] + " " + (_dtAuthorty.Rows[j]["tpname"].ToString() == "" ? "X" : "O");
                                        _tbRow[1] = _dtAuthorty.Rows[j]["pname"];
                                        thispname = _dtAuthorty.Rows[j]["pname"].ToString();
                                    }
                                    if (thiscname == _dtAuthorty.Rows[j]["cname"].ToString())
                                    {
                                        _tbRow[2] = "";
                                    }
                                    else
                                    {
                                        _tbRow[2] = _dtAuthorty.Rows[j]["cname"] + " " + (_dtAuthorty.Rows[j]["tcname"].ToString() == "" ? "X" : "O");
                                        thiscname = _dtAuthorty.Rows[j]["cname"].ToString();
                                    }
                                    if (_dtAuthorty.Rows[j]["tname"].ToString() == "")
                                    {
                                        _tbRow[3] = "";
                                    }
                                    else
                                    {
                                        if (_dtAuthorty.Rows[j]["ttname"].ToString() == "" || _dtAuthorty.Rows[j]["functionId"].ToString() == "")
                                        {
                                            _tbRow[3] = _dtAuthorty.Rows[j]["tname"] + " " + "X";
                                        }
                                        else
                                        {
                                            _tbRow[3] = _dtAuthorty.Rows[j]["tname"] + " " + "O";
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    _tbRow[1] = "";
                                    _tbRow[2] = "";
                                    _tbRow[3] = "";
                                }
                            }
                            _dtone.Rows.Add(_tbRow);
                        }
                    }
                    #endregion
                    comName.Add(true);
                    Elist.Add(_dtone);
                    NameList.Add(_dt.Rows[i]["groupName"].ToString() + "群組");
                    thispname = "";
                    thiscname = "";
                }

                string fileName = "群組權限信息" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                MemoryStream ms = ExcelHelperXhf.ExportDTNoColumnsBySdy(Elist, NameList, comName);
                Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
                Response.BinaryWrite(ms.ToArray());
            }
            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);
            }

        }
Esempio n. 5
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase Delete()
        {
            fgMgr = new FgroupMgr(mySqlConnectionString);
            string json = string.Empty;

            try
            {
                if (!string.IsNullOrEmpty(Request.Form["rowID"]))
                {
                    string rowIDs = Request.Form["rowID"];
                    if (rowIDs.IndexOf("|") != -1)
                    {
                        foreach (string id in rowIDs.Split('|'))
                        {
                            if (!string.IsNullOrEmpty(id))
                            {
                                fg.rowid = Int32.Parse(id);
                                fgMgr.Delete(fg);
                            }
                        }
                        json = "{success:true,msg:\"删除成功\"}";
                    }
                    else
                    {
                        json = "{success:true,msg:\"删除失败\"}";
                    }
                }
                else
                {
                    json = "{success:true,msg:\"删除失败\"}";
                }
            }
            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 = "{success:true,msg:\"删除失败\"}";
            }

            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();

            return this.Response;
        }
Esempio n. 6
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase Edit()
        {
            fgMgr = new FgroupMgr(mySqlConnectionString);
            string json = string.Empty;

            try
            {
                if (!string.IsNullOrEmpty(Request.Form["rowid"]))
                {
                    fg.rowid = Convert.ToInt32(Request.Form["rowid"]);
                }

                if (!string.IsNullOrEmpty(Request.Form["groupName"]))
                {
                    fg.groupName = Request.Form["groupName"];
                }

                if (!string.IsNullOrEmpty(Request.Form["groupCode"]))
                {
                    fg.groupCode = Request.Form["groupCode"];
                }

                if (!string.IsNullOrEmpty(Request.Form["remark"]))
                {
                    fg.remark = Request.Form["remark"];
                }

                fg.kuser = "";
                int num = fgMgr.Save(fg);

                if (num == -1)
                {
                    json = "{success:true,msg:\"群組名稱 或 群組編號已存在。\"}";
                }
                else if (num == 2)
                {
                    json = "{success:true,msg:\"修改成功\"}";
                }
                else
                {
                    json = "{success:true,msg:\"修改失败\"}";
                }
            }
            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 = "{success:true,msg:\"修改失败\"}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }