예제 #1
0
파일: KPIDAL.cs 프로젝트: xuefuruanjian/ems
        public KPIInfo ReadKPI(int id)
        {
            SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.NVarChar) };
            pt[0].Value = id;
            KPIInfo info = new KPIInfo();

            using (SqlDataReader dr = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "ReadKPI", pt))
            {
                if (dr.Read())
                {
                    info.ID           = int.Parse(dr["ID"].ToString());
                    info.Name         = dr["Name"].ToString();
                    info.ParentId     = int.Parse(dr["ParentId"].ToString());
                    info.EvaluateInfo = dr["EvaluateInfo"].ToString();
                    info.Method       = dr["Method"].ToString();
                    info.Scorse       = float.Parse(dr["Scorse"].ToString());
                    info.Other        = dr["Other"].ToString();
                    info.CompanyID    = int.Parse(dr["CompanyID"].ToString());
                    info.State        = int.Parse(dr["State"].ToString());
                    info.Sort         = int.Parse(dr["Sort"].ToString());
                    info.AddDate      = Convert.ToDateTime(dr["AddDate"].ToString());
                    info.RefPostId    = int.Parse(dr["RefPostId"].ToString());
                    info.Type         = (KPIType)dr["Type"];
                }
            }
            return(info);
        }
예제 #2
0
파일: KPIDAL.cs 프로젝트: xuefuruanjian/ems
        public int AddKPI(KPIInfo kpi)
        {
            SqlParameter[] pt = new SqlParameter[] {
                new SqlParameter("@name", SqlDbType.NVarChar),
                new SqlParameter("@parentId", SqlDbType.Int),
                new SqlParameter("@evaluateInfo", SqlDbType.NVarChar),
                new SqlParameter("@method", SqlDbType.NVarChar),
                new SqlParameter("@scorse", SqlDbType.Float),
                new SqlParameter("@other", SqlDbType.NVarChar),
                new SqlParameter("@companyID", SqlDbType.Int),
                new SqlParameter("@state", SqlDbType.Int),
                new SqlParameter("@sort", SqlDbType.Int),
                new SqlParameter("@refPostId", SqlDbType.Int),
                new SqlParameter("@type", SqlDbType.Int)
            };

            pt[0].Value  = kpi.Name;
            pt[1].Value  = kpi.ParentId;
            pt[2].Value  = kpi.EvaluateInfo;
            pt[3].Value  = kpi.Method;
            pt[4].Value  = kpi.Scorse;
            pt[5].Value  = kpi.Other;
            pt[6].Value  = kpi.CompanyID;
            pt[7].Value  = kpi.State;
            pt[8].Value  = kpi.Sort;
            pt[9].Value  = kpi.RefPostId;
            pt[10].Value = kpi.Type;
            return(Convert.ToInt32(ShopMssqlHelper.ExecuteScalar(ShopMssqlHelper.TablePrefix + "AddKPI", pt)));
        }
예제 #3
0
파일: KPIDAL.cs 프로젝트: xuefuruanjian/ems
        public void UpdateKPI(KPIInfo kpi)
        {
            SqlParameter[] pt = new SqlParameter[] {
                new SqlParameter("@id", SqlDbType.Int),
                new SqlParameter("@name", SqlDbType.NVarChar),
                new SqlParameter("@parentId", SqlDbType.Int),
                new SqlParameter("@evaluateInfo", SqlDbType.NVarChar),
                new SqlParameter("@method", SqlDbType.NVarChar),
                new SqlParameter("@scorse", SqlDbType.Float),
                new SqlParameter("@other", SqlDbType.NVarChar),
                new SqlParameter("@companyID", SqlDbType.Int),
                new SqlParameter("@state", SqlDbType.Int),
                new SqlParameter("@sort", SqlDbType.Int),
                new SqlParameter("@refPostId", SqlDbType.Int),
                new SqlParameter("@type", SqlDbType.Int)
            };

            pt[0].Value  = kpi.ID;
            pt[1].Value  = kpi.Name;
            pt[2].Value  = kpi.ParentId;
            pt[3].Value  = kpi.EvaluateInfo;
            pt[4].Value  = kpi.Method;
            pt[5].Value  = kpi.Scorse;
            pt[6].Value  = kpi.Other;
            pt[7].Value  = kpi.CompanyID;
            pt[8].Value  = kpi.State;
            pt[9].Value  = kpi.Sort;
            pt[10].Value = kpi.RefPostId;
            pt[11].Value = kpi.Type;

            ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateKPI", pt);
        }
예제 #4
0
파일: KPIAdd.cs 프로젝트: xuefuruanjian/ems
        protected override void PostBack()
        {
            KPIInfo kpiClass = new KPIInfo();

            kpiClass.ID           = ID;
            kpiClass.CompanyID    = RequestHelper.GetForm <int>("CompanyID");
            kpiClass.ParentId     = RequestHelper.GetForm <int>("ClassID");
            kpiClass.Name         = StringHelper.AddSafe(RequestHelper.GetForm <string>("Name"));
            kpiClass.EvaluateInfo = StringHelper.AddSafe(RequestHelper.GetForm <string>("Introduction"));
            kpiClass.Method       = StringHelper.AddSafe(RequestHelper.GetForm <string>("Method"));
            kpiClass.Type         = (KPIType)RequestHelper.GetForm <int>("Type");
            int score = RequestHelper.GetForm <int>("Score");

            if (score > 0)
            {
                kpiClass.Scorse = (float)score;
            }
            else
            {
                kpiClass.Scorse = 0;
            }
            kpiClass.Sort = RequestHelper.GetForm <int>("Sort");

            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (kpiClass.ID == int.MinValue)
            {
                base.CheckUserPower("AddKPI", PowerCheckType.Single);
                int id = KPIBLL.AddKPI(kpiClass);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("KPI"), id);
            }
            else
            {
                base.CheckUserPower("UpdateKPI", PowerCheckType.Single);
                KPIBLL.UpdateKPI(kpiClass);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("KPI"), kpiClass.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            string returnURL = ServerHelper.UrlDecode(RequestHelper.GetQueryString <string>("ReturnURL"));

            if (string.IsNullOrEmpty(returnURL))
            {
                ScriptHelper.Alert(alertMessage, "/User/KPIAdd.aspx?CompanyID=" + kpiClass.CompanyID.ToString() + "&ClassID=" + kpiClass.ParentId.ToString());
            }
            else
            {
                ScriptHelper.Alert(alertMessage, returnURL);
            }
        }
예제 #5
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            KPIInfo kpiCate = new KPIInfo();

            CompanyID = RequestHelper.GetForm <int>("CompanyId");
            if (CompanyID < 0)
            {
                ScriptHelper.Alert("请重新选择公司");
            }
            kpiCate.CompanyID = CompanyID;
            kpiCate.ID        = RequestHelper.GetQueryString <int>("ID");
            if (string.IsNullOrEmpty(FatherID.Text))
            {
                ScriptHelper.Alert("请选择分类");
            }
            kpiCate.ParentId     = Convert.ToInt32(FatherID.SelectedValue);
            kpiCate.Sort         = Convert.ToInt32(Sort.Text);
            kpiCate.Name         = ClassName.Text;
            kpiCate.EvaluateInfo = Introduction.Text;// string.Empty;
            kpiCate.Method       = Method.Text;
            kpiCate.Type         = (KPIType)int.Parse(Type.Text);
            if (!string.IsNullOrEmpty(Score.Text))
            {
                kpiCate.Scorse = float.Parse(Score.Text);
            }
            else
            {
                kpiCate.Scorse = 0;
            }

            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (kpiCate.ID == int.MinValue)
            {
                base.CheckAdminPower("AddKPI", PowerCheckType.Single);
                int id = KPIBLL.AddKPI(kpiCate);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("KPI"), id);
                ScriptHelper.Alert(alertMessage, Request.Url.AbsolutePath + "?CompanyId=" + kpiCate.CompanyID.ToString() + "&ParentID=" + kpiCate.ParentId.ToString());
            }
            else
            {
                base.CheckAdminPower("UpdateKPI", PowerCheckType.Single);
                KPIBLL.UpdateKPI(kpiCate);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("KPI"), kpiCate.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
                ScriptHelper.Alert(alertMessage, base.Server.UrlDecode(RequestHelper.GetQueryString <string>("ReturnUrl")));
            }
        }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                if (CompanyID >= 0)
                {
                    CompanyName.Value = CompanyBLL.ReadCompany(CompanyID).CompanyName;
                }

                KPISearchInfo kpi = new KPISearchInfo();
                kpi.ParentId = "0";

                this.FatherID.DataSource     = KPIBLL.SearchKPIList(kpi);
                this.FatherID.DataTextField  = "Name";
                this.FatherID.DataValueField = "ID";
                this.FatherID.DataBind();
                this.FatherID.Items.Insert(0, new ListItem("请选择分类", ""));
                FatherID.SelectedValue = ParentID.ToString();

                Type.DataSource     = EnumHelper.ReadEnumList <KPIType>();
                Type.DataTextField  = "ChineseName";
                Type.DataValueField = "Value";
                Type.DataBind();

                int queryString = RequestHelper.GetQueryString <int>("ID");

                if (queryString != int.MinValue)
                {
                    base.CheckAdminPower("ReadKPI", PowerCheckType.Single);
                    KPIInfo info = KPIBLL.ReadKPI(queryString);
                    CompanyName.Value = CompanyBLL.ReadCompany(info.CompanyID).CompanyName;
                    CompanyID         = info.CompanyID;
                    Type.Text         = ((int)info.Type).ToString();
                    FatherID.Text     = info.ParentId.ToString();
                    Sort.Text         = info.Sort.ToString();
                    ClassName.Text    = info.Name;
                    Introduction.Text = info.EvaluateInfo;
                    Score.Text        = info.Scorse.ToString();
                    Method.Text       = info.Method;
                }
            }
        }
예제 #7
0
파일: KPIAdd.cs 프로젝트: xuefuruanjian/ems
        protected override void PageLoad()
        {
            base.PageLoad();
            base.Title = "Ìí¼ÓKPIÖ¸±ê";

            base.CheckUserPower("ReadKPI,AddKPI,UpdateKPI", PowerCheckType.OR);

            KPISearchInfo kpiSearch = new KPISearchInfo();

            kpiSearch.ParentId = "0";
            KPIClassList       = KPIBLL.SearchKPIList(kpiSearch);

            KPITypeList = EnumHelper.ReadEnumList <KPIType>();

            if (ID > 0)
            {
                KPI       = KPIBLL.ReadKPI(ID);
                CompanyID = KPI.CompanyID;
                ClassID   = KPI.ParentId;
            }
        }
예제 #8
0
파일: KPIDAL.cs 프로젝트: xuefuruanjian/ems
 public void PrepareModel(SqlDataReader dr, List <KPIInfo> kpiList)
 {
     while (dr.Read())
     {
         KPIInfo info = new KPIInfo();
         {
             info.ID           = int.Parse(dr["ID"].ToString());
             info.Name         = dr["Name"].ToString();
             info.ParentId     = int.Parse(dr["ParentId"].ToString());
             info.EvaluateInfo = dr["EvaluateInfo"].ToString();
             info.Method       = dr["Method"].ToString();
             info.Scorse       = float.Parse(dr["Scorse"].ToString());
             info.Other        = dr["Other"].ToString();
             info.CompanyID    = int.Parse(dr["CompanyID"].ToString());
             info.State        = int.Parse(dr["State"].ToString());
             info.Sort         = int.Parse(dr["Sort"].ToString());
             info.AddDate      = Convert.ToDateTime(dr["AddDate"].ToString());
             info.RefPostId    = int.Parse(dr["RefPostId"].ToString());
             info.Type         = (KPIType)dr["Type"];
         }
         kpiList.Add(info);
     }
 }
예제 #9
0
 public static void UpdateKPI(KPIInfo kpi)
 {
     dal.UpdateKPI(kpi);
 }
예제 #10
0
 public static int AddKPI(KPIInfo kpi)
 {
     return(dal.AddKPI(kpi));
 }