Exemple #1
0
        protected void btnAddPosition_Click(object sender, EventArgs e)
        {
            int index = KPI_PositionDal.PositionIDCounts();

            string sID = PageControl.GetGuid();

            KPI_PositionEntity ote = new KPI_PositionEntity();

            ote.PositionID      = sID;
            ote.PositionName    = "InputName";
            ote.PositionDesc    = "";
            ote.PositionWeight  = 10;
            ote.PositionIsHand  = "1";
            ote.PositionIsShift = "1";
            ote.PositionIsValid = "1";
            ote.PositionNote    = "";

            ote.PositionCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
            ote.PositionModifyTime = ote.PositionCreateTime;

            if (KPI_PositionDal.Insert(ote))
            {
                //MessageBox.popupClientMessage(this.Page, "添加成功!", "call();");
            }
            else
            {
                MessageBox.popupClientMessage(this.Page, "添加错误!", "call();");
            }

            gvPosition.EditIndex = index;

            BindPosition();
        }
Exemple #2
0
        private void ClientInitial()
        {
            List <KPI_UnitEntity> UnitList = KPI_UnitDal.GetAllEntity();

            //drpUnits.Items.Add(new ListItem("全厂", "00"));
            drpSUnits.Items.Add(new ListItem("【所有机组】", ""));
            foreach (KPI_UnitEntity Unit in UnitList)
            {
                drpSUnits.Items.Add(new ListItem(Unit.UnitName, Unit.UnitID));
                drpUnits.Items.Add(new ListItem(Unit.UnitName, Unit.UnitID));
            }

            DataTable Shifts = KPI_ShiftDal.GetShifts();

            drpSShifts.Items.Add(new ListItem("【所有值次】", ""));
            foreach (DataRow dr in Shifts.Rows)
            {
                drpShifts.Items.Add(new ListItem(dr["Name"] + "值", dr["Name"] + ""));
                drpSShifts.Items.Add(new ListItem(dr["Name"] + "值", dr["Name"] + ""));
            }
            Shifts.Dispose();

            DataTable PositionTable = KPI_PositionDal.GetDataTable();

            foreach (DataRow dr in PositionTable.Rows)
            {
                drpPositions.Items.Add(new ListItem(dr["PositionName"] + "", dr["PositionID"] + ""));
            }
            PositionTable.Dispose();
        }
Exemple #3
0
        /// <summary>
        ///  //设备信息
        /// </summary>
        void BindPosition()
        {
            //设备信息
            DataTable dtPosition = KPI_PositionDal.GetSearchList("");

            gvPosition.DataSource = dtPosition;
            gvPosition.DataBind();
        }
Exemple #4
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);
            }
        }
        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);
            }
        }
Exemple #6
0
        private void BindPosition()
        {
            DataTable dt = KPI_PositionDal.GetDataTable();

            ddlPosition.Items.Add(new ListItem("全部", "ALL"));
            foreach (DataRow dr in dt.Rows)
            {
                ddlPosition.Items.Add(new ListItem(dr["PositionName"].ToString(), dr["PositionID"].ToString()));
            }
            ddlPosition.SelectedValue = "ALL";
        }
Exemple #7
0
        protected void gvPosition_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string keyid = e.CommandArgument.ToString();

            if (e.CommandName == "dataDelete")
            {
                if (KPI_PositionDal.DeletePosition(keyid))
                {
                    MessageBox.popupClientMessage(this.Page, "删除成功!", "call();");

                    BindPosition();
                }
                else
                {
                    MessageBox.popupClientMessage(this.Page, "删除错误!", "call();");
                }
            }
        }
Exemple #8
0
        protected void gvPosition_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            HtmlInputHidden key = (HtmlInputHidden)gvPosition.Rows[e.RowIndex].Cells[0].FindControl("Positionid");

            string sID     = key.Value;
            string sName   = ((TextBox)(gvPosition.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim();
            string sDesc   = ((TextBox)(gvPosition.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim();
            string sWeight = ((TextBox)(gvPosition.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
            //DropDownList需要采用此类方法
            string sHand  = ((DropDownList)(gvPosition.Rows[e.RowIndex].Cells[4].FindControl("ddlHand"))).SelectedValue;
            string sShift = ((DropDownList)(gvPosition.Rows[e.RowIndex].Cells[5].FindControl("ddlShift"))).SelectedValue;
            string sValid = ((DropDownList)(gvPosition.Rows[e.RowIndex].Cells[6].FindControl("ddlValid"))).SelectedValue;
            string sNote  = ((TextBox)(gvPosition.Rows[e.RowIndex].Cells[7].Controls[0])).Text.ToString().Trim();

            string msg = "";

            if (sName == "")
            {
                msg += "名称不能为空!\r\n";
            }

            //判断double格式
            if (!Regex.IsMatch(sWeight, @"^\d*[.]?\d*$"))
            {
                msg += "权重只能为数字组成!\r\n";
            }

            if (msg != "")
            {
                MessageBox.popupClientMessage(this.Page, msg);
                return;
            }

            //代码是否重复
            if (KPI_PositionDal.PositionNameExists(sName, sID))
            {
                MessageBox.popupClientMessage(this.Page, "已存在相同的代码!");
                return;
            }

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

            ote.PositionID         = sID;
            ote.PositionName       = sName;
            ote.PositionDesc       = sDesc;
            ote.PositionWeight     = double.Parse(sWeight);
            ote.PositionIsHand     = sHand;
            ote.PositionIsShift    = sShift;
            ote.PositionIsValid    = sValid;
            ote.PositionNote       = sNote;
            ote.PositionModifyTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");

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

            gvPosition.EditIndex = -1;

            BindPosition();
        }