コード例 #1
0
ファイル: KPI_TeamConfig.aspx.cs プロジェクト: jht1983/SISKPI
        protected void gvTeam_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            HtmlInputHidden key = (HtmlInputHidden)gvTeam.Rows[e.RowIndex].Cells[0].FindControl("teamid");

            string sID     = key.Value;
            string sShift  = ((DropDownList)(gvTeam.Rows[e.RowIndex].Cells[1].FindControl("ddlShift"))).SelectedValue;
            string sPerson = ((DropDownList)(gvTeam.Rows[e.RowIndex].Cells[2].FindControl("ddlPerson"))).SelectedValue;
            //string sPosition = ((DropDownList)(gvTeam.Rows[e.RowIndex].Cells[3].FindControl("ddlPosition"))).SelectedValue;
            string sTeamPerson = ((DropDownList)(gvTeam.Rows[e.RowIndex].Cells[4].FindControl("ddlTeamPerson"))).SelectedValue;
            string sNote       = ((TextBox)(gvTeam.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim();

            //更新
            KPI_TeamEntity ote = new KPI_TeamEntity();

            ote.TeamID         = sID;
            ote.ShiftID        = sShift;
            ote.PersonID       = sPerson;
            ote.PositionID     = KPI_PersonDal.GetPositionID(sPerson); //防止乱选sPosition;
            ote.TeamPersonID   = sTeamPerson;
            ote.TeamNote       = sNote;
            ote.TeamModifyTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");

            if (KPI_TeamDal.Update(ote))
            {
                MessageBox.popupClientMessage(this.Page, "编辑成功!", "call();");
            }
            else
            {
                MessageBox.popupClientMessage(this.Page, "编辑错误!", "call();");
            }

            gvTeam.EditIndex = -1;

            BindTeam();
        }
コード例 #2
0
        protected bool ImportFromExcelToModify(DataSet ds)
        {
            try
            {
                System.Data.DataTable dt = ds.Tables[0];

                int nAll     = dt.Rows.Count;
                int nModify  = 0;
                int nNoExist = 0;

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    if (dr["SelectX"].ToString().ToLower() == "x")
                    {
                        string PersonCode = dr["PersonCode"].ToString().Trim();

                        //判断是否存在
                        if (!KPI_PersonDal.PersonCodeExists(PersonCode, ""))
                        {
                            //MessageBox.popupClientMessage(this.Page, " 该机组的输出标签已存在!", "call();");
                            nNoExist += 1;
                            continue;
                        }

                        //main tag
                        string keyid = KPI_PersonDal.GetPersonID(PersonCode);

                        KPI_PersonEntity mEntity = new KPI_PersonEntity();
                        mEntity.PersonID      = keyid;
                        mEntity.PositionID    = KPI_PositionDal.GetPositionID(dr["PositionName"].ToString().Trim());
                        mEntity.PersonCode    = PersonCode;
                        mEntity.PersonName    = dr["PersonName"].ToString().Trim();
                        mEntity.PersonDesc    = dr["PersonDesc"].ToString().Trim();
                        mEntity.PersonIsValid = dr["PersonIsValid"].ToString().Trim();
                        mEntity.PersonNote    = dr["PersonNote"].ToString().Trim();

                        KPI_PersonDal.Update(mEntity);

                        nModify += 1;
                    }
                }

                string strInfor = "标签点总数为:{0}个, 修改成功:{1}个,不存在标签点: {2}个。";
                strInfor = string.Format(strInfor, nAll, nModify, nNoExist);

                MessageBox.popupClientMessage(this.Page, strInfor, "call();");

                return(true);
            }
            catch (Exception ee)
            {
                //
                MessageBox.popupClientMessage(this.Page, ee.Message, "call();");

                return(false);
            }
        }
コード例 #3
0
        protected bool ImportFromExcelToCreate(DataSet ds)
        {
            try
            {
                System.Data.DataTable dt = ds.Tables[0];

                int nAll    = dt.Rows.Count;
                int nCreate = 0;
                int nExist  = 0;

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    if (dr["SelectX"].ToString().ToLower() == "x")
                    {
                        //string PersonCode = dr["PersonCode"].ToString().Trim();

                        ////判断是否存在
                        //if (KPI_PersonDal.PersonCodeExists(PersonCode, ""))
                        //{
                        //    //MessageBox.popupClientMessage(this.Page, " 该机组的输出标签已存在!", "call();");
                        //    nExist += 1;
                        //    continue;
                        //}

                        //main tag
                        string         keyid   = PageControl.GetGuid();
                        KPI_TeamEntity mEntity = new KPI_TeamEntity();
                        mEntity.TeamID     = keyid;
                        mEntity.PlantID    = KPI_PlantDal.GetPlantID(dr["PlantName"].ToString().Trim());
                        mEntity.ShiftID    = KPI_ShiftDal.GetShiftID(dr["ShiftName"].ToString().Trim());
                        mEntity.PersonID   = KPI_PersonDal.GetPersonID(dr["PersonCode"].ToString().Trim());
                        mEntity.PositionID = KPI_PersonDal.GetPositionID(mEntity.PersonID);
                        //PersonName,无多大意义
                        mEntity.PositionID = KPI_PositionDal.GetPositionID(dr["PositionName"].ToString().Trim());
                        mEntity.TeamNote   = dr["TeamNote"].ToString().Trim();

                        KPI_TeamDal.Insert(mEntity);

                        nCreate += 1;
                    }
                }

                string strInfor = "标签点总数为:{0}个, 创建成功:{1}个,已存在标签点: {2}个。";
                strInfor = string.Format(strInfor, nAll, nCreate, nExist);

                MessageBox.popupClientMessage(this.Page, strInfor, "call();");

                return(true);
            }
            catch (Exception ee)
            {
                //
                MessageBox.popupClientMessage(this.Page, ee.Message, "call();");

                return(false);
            }
        }
コード例 #4
0
 protected void btnDeletePerson_Click(object sender, EventArgs e)
 {
     using (KPI_PersonDal DataAccess = new KPI_PersonDal()) {
         int Succeed = DataAccess.DeletePerson(GetPersonUI());
         if (Succeed > 0) ShowMessage("数据删除成功!");
         if (Succeed < 0) ShowMessage("数据删除失败!");
     }
     DataBind();
     SetUIState("Default");
 }
コード例 #5
0
 protected void btnSavePerson_Click(object sender, EventArgs e)
 {
     KPI_PersonEntity Result = GetPersonUI();
     using (KPI_PersonDal DataAccess = new KPI_PersonDal()) {
         int Succeed = DataAccess.SavePerson(Result);
         if (Succeed > 0) ShowMessage("数据保存成功!");
         if (Succeed < 0) ShowMessage("数据保存失败!");
     }
     DataBind();
     SetUIState("Default");
 }
コード例 #6
0
 public override void DataBind()
 {
     using (KPI_PersonDal DataAccess = new KPI_PersonDal()) {
         int RecordCount = 0;
         PersonRepeater.DataSource = DataAccess.GetPersons(drpSSpecialFields.SelectedValue,
             drpSUnits.SelectedValue, drpSShifts.SelectedValue,
             Pager.CurrentPageIndex, Pager.PageSize,out RecordCount);
         Pager.RecordCount = RecordCount;
     }
     base.DataBind();
 }
コード例 #7
0
 public override void DataBind()
 {
     using (KPI_PersonDal DataAccess = new KPI_PersonDal()) {
         int RecordCount = 0;
         PersonRepeater.DataSource = DataAccess.GetPersons(drpSSpecialFields.SelectedValue,
                                                           drpSUnits.SelectedValue, drpSShifts.SelectedValue,
                                                           Pager.CurrentPageIndex, Pager.PageSize, out RecordCount);
         Pager.RecordCount = RecordCount;
     }
     base.DataBind();
 }
コード例 #8
0
        protected bool ImportFromExcelToDelete(DataSet ds)
        {
            try
            {
                System.Data.DataTable dt = ds.Tables[0];

                int nAll    = dt.Rows.Count;
                int nDelete = 0;
                int nEmpty  = 0;

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    if (dr["SelectX"].ToString().ToLower() == "x")
                    {
                        string PersonCode = dr["PersonCode"].ToString().Trim();

                        //判断是否存在
                        if (!KPI_PersonDal.PersonCodeExists(PersonCode, ""))
                        {
                            //MessageBox.popupClientMessage(this.Page, " 该机组的输出标签已存在!", "call();");
                            nEmpty += 1;
                            continue;
                        }
                        else
                        {
                            //main tag
                            //string RealID = KPI_PersonDal.GetRealID(PersonCode);

                            KPI_PersonEntity mEntity = new KPI_PersonEntity();
                            mEntity.PersonID = KPI_PersonDal.GetPersonID(PersonCode);

                            KPI_PersonDal.Delete(mEntity);
                            nDelete += 1;
                        }
                    }
                }

                string strInfor = "标签点总数为:{0}个, 删除成功:{1}个,空标签点: {2}个。";
                strInfor = string.Format(strInfor, nAll, nDelete, nEmpty);

                MessageBox.popupClientMessage(this.Page, strInfor, "call();");

                return(true);
            }
            catch (Exception ee)
            {
                //
                MessageBox.popupClientMessage(this.Page, ee.Message, "call();");

                return(false);
            }
        }
コード例 #9
0
 protected void btnDeletePerson_Click(object sender, EventArgs e)
 {
     using (KPI_PersonDal DataAccess = new KPI_PersonDal()) {
         int Succeed = DataAccess.DeletePerson(GetPersonUI());
         if (Succeed > 0)
         {
             ShowMessage("数据删除成功!");
         }
         if (Succeed < 0)
         {
             ShowMessage("数据删除失败!");
         }
     }
     DataBind();
     SetUIState("Default");
 }
コード例 #10
0
ファイル: KPI_TeamConfig.aspx.cs プロジェクト: jht1983/SISKPI
        /// <summary>
        /// 编辑时,岗位随着人变化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ddlPerson_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList DDPerson = (DropDownList)sender;                           //获取现在的事件触发者:人的DropDownList
            GridViewRow  gvr      = (GridViewRow)DDPerson.NamingContainer;          //人与岗位同属于在一个NamingContainer下

            DropDownList DDPosition = (DropDownList)gvr.FindControl("ddlPosition"); //找到岗位的DropDownList

            string strperson     = DDPerson.SelectedValue;
            string strpositionid = KPI_PersonDal.GetPositionID(strperson);

            DDPosition.SelectedValue = strpositionid;

            //DDCun.DataSource = getCommon_cun(DDXiang.SelectedValue).Tables[0].DefaultView;//这个函数是我自定义的,通过乡的编辑取得与之对应的村的数据集
            //DDCun.DataTextField = "村名";
            //DDCun.DataValueField = "编号";
            //DDCun.DataBind();
        }
コード例 #11
0
        protected void btnSavePerson_Click(object sender, EventArgs e)
        {
            KPI_PersonEntity Result = GetPersonUI();

            using (KPI_PersonDal DataAccess = new KPI_PersonDal()) {
                int Succeed = DataAccess.SavePerson(Result);
                if (Succeed > 0)
                {
                    ShowMessage("数据保存成功!");
                }
                if (Succeed < 0)
                {
                    ShowMessage("数据保存失败!");
                }
            }
            DataBind();
            SetUIState("Default");
        }
コード例 #12
0
 /// <summary>
 /// 填充界面
 /// </summary>
 private void SetPersonUI()
 {
     using (KPI_PersonDal DataAccess = new KPI_PersonDal()) {
         KPI_PersonEntity Result = DataAccess.GetKPI_Person(PersonID);
         if (Result == null)
         {
             return;
         }
         drpPositions.SelectedValue     = Result.PositionID;
         txtPersonCode.Text             = Result.PersonCode;
         txtPersonName.Text             = Result.PersonName;
         txtPersonDesc.Text             = Result.PersonDesc;
         chkPersonIsValid.Checked       = Result.PersonIsValid == "1";
         txtPersonNote.Text             = Result.PersonNote;
         drpUnits.SelectedValue         = Result.UnitID;
         drpShifts.SelectedValue        = Result.Shift;
         drpSpecialFields.SelectedValue = Result.SpecialField;
     }
 }
コード例 #13
0
        //导出
        protected void btnExcelExport_Click(object sender, EventArgs e)
        {
            string strExcelFile = "SIS人员信息表";

            try
            {
                System.Data.DataTable dt = KPI_PersonDal.GetPersonListForExcel();

                if (dt == null)
                {
                    return;
                }

                ExportToSpreadsheet(dt, strExcelFile);
            }
            catch (Exception ee)
            {
                MessageBox.popupClientMessage(this.Page, "导出信息错误!" + ee.Message, "call();");

                return;
            }

            return;
        }
コード例 #14
0
 /// <summary>
 /// 填充界面
 /// </summary>
 private void SetPersonUI()
 {
     using (KPI_PersonDal DataAccess = new KPI_PersonDal()) {
         KPI_PersonEntity Result = DataAccess.GetKPI_Person(PersonID);
         if (Result == null) return;
         drpPositions.SelectedValue = Result.PositionID;
         txtPersonCode.Text = Result.PersonCode;
         txtPersonName.Text = Result.PersonName;
         txtPersonDesc.Text = Result.PersonDesc;
         chkPersonIsValid.Checked = Result.PersonIsValid=="1";
         txtPersonNote.Text = Result.PersonNote;
         drpUnits.SelectedValue = Result.UnitID;
         drpShifts.SelectedValue = Result.Shift;
         drpSpecialFields.SelectedValue = Result.SpecialField;
     }
 }
コード例 #15
0
 public override void DataBind()
 {
     PersonRepeater.DataSource = KPI_PersonDal.GetPersons(drpUnits.SelectedValue, drpShifts.SelectedValue);
     base.DataBind();
 }
コード例 #16
0
        /// <summary>
        ///
        /// </summary>
        void BindSampleValues()
        {
            //string ECWeb = ViewState["ecweb"].ToString();

            //if (ECWeb.Equals(""))
            //{
            //    return;
            //}

            //绑定参数
            DataTable dt = KPI_PersonDal.GetSearchList("");


            //
//"select PersonID, PersonCode, PersonName, ShiftName, PositionName, PositionWeight,
//                            ''ECScore, ''SASCore, ''AllScore, ''PersonSort
//                            from KPI_Person  a
            dt.Clear();

            DataRow dr = dt.NewRow();

            dr["PersonID"]    = "1111";
            dr["ShiftName"]   = "一值";
            dr["ECScore"]     = "1560";
            dr["SAScore"]     = "2458";
            dr["AllScore"]    = "4018";
            dr["PersonSort"]  = "1";
            dr["PersonMoney"] = "11000";

            dt.Rows.Add(dr);

            dr                = dt.NewRow();
            dr["PersonID"]    = "1111";
            dr["ShiftName"]   = "二值";
            dr["ECScore"]     = "1540";
            dr["SASCore"]     = "2438";
            dr["AllScore"]    = "3978";
            dr["PersonSort"]  = "2";
            dr["PersonMoney"] = "7000";

            dt.Rows.Add(dr);

            dr                = dt.NewRow();
            dr["PersonID"]    = "1111";
            dr["ShiftName"]   = "五值";
            dr["ECScore"]     = "1240";
            dr["SASCore"]     = "2338";
            dr["AllScore"]    = "3578";
            dr["PersonSort"]  = "3";
            dr["PersonMoney"] = "6000";

            dt.Rows.Add(dr);

            dr                = dt.NewRow();
            dr["PersonID"]    = "1111";
            dr["ShiftName"]   = "四值";
            dr["ECScore"]     = "1240";
            dr["SASCore"]     = "2338";
            dr["AllScore"]    = "3578";
            dr["PersonSort"]  = "3";
            dr["PersonMoney"] = "4000";

            dt.Rows.Add(dr);

            dr                = dt.NewRow();
            dr["PersonID"]    = "1111";
            dr["ShiftName"]   = "三值";
            dr["ECScore"]     = "1240";
            dr["SASCore"]     = "2338";
            dr["AllScore"]    = "3578";
            dr["PersonSort"]  = "3";
            dr["PersonMoney"] = "2000";

            dt.Rows.Add(dr);


            //绑定最优参数
            gvSnapshot.DataSource = dt;

            gvSnapshot.DataBind();
        }