Beispiel #1
0
        /// <summary>
        /// 检查查询条件数据有效性
        /// </summary>
        /// <returns></returns>
        private bool ValidateQueryCondition()
        {
            Boolean l_blnIsValid = true;

            if (!String.IsNullOrEmpty(this.txtStartDate.ValStr.TrimEnd()) && !ValidateUtility.IsDateTime(this.txtStartDate.ValStr.TrimEnd()))
            {
                m_strAryMessages.Add("发起日期:开始日期格式不正确!例:XXXX-XX-XX 或 XXXX/XX/XX");
                l_blnIsValid = false;
            }
            if (!String.IsNullOrEmpty(this.txtEndDate.ValStr.TrimEnd()) && !ValidateUtility.IsDateTime(this.txtEndDate.ValStr.TrimEnd()))
            {
                m_strAryMessages.Add("发起日期:结束日期格式不正确!例:XXXX-XX-XX 或 XXXX/XX/XX");
                l_blnIsValid = false;
            }
            if (!l_blnIsValid)
            {
                return(false);
            }
            if (!String.IsNullOrEmpty(this.txtStartDate.ValStr.TrimEnd()) && !String.IsNullOrEmpty(this.txtEndDate.ValStr.TrimEnd()))
            {
                if (this.txtStartDate.ValDate > this.txtEndDate.ValDate)
                {
                    m_strAryMessages.Add("发起日期:开始日期必须小于等于结束日期");
                    return(false);
                }
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// 關閉離開
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripbtnExit_Click(object sender, EventArgs e)
        {
            if (GlobalParameter.UseMode.Equals("1"))
            {
                try
                {
                    // 遮光閥開啟
                    if (SHT遮光閥狀態.Equals("0") || SHT遮光閥狀態.Equals("\0"))
                    {
                        string cmd      = LaserCommand.MKM指令接收控制設定("1");
                        string response = LaserExecuteWrite.執行MRK印字觸控制設定(cmd);
                        if (ValidateUtility.DisplayMessage(response))
                        {
                            return;
                        }
                        SHT遮光閥狀態 = "1";
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex, "Error");
                }
            }

            this.Close();
        }
Beispiel #3
0
        public Card getBeanFromDataRow(DataRow dr)
        {
            Card card = new Card();

            if (dr != null)
            {
                card.ID         = (int)dr["Card.ID"];
                card.Code       = dr["code"] as string;
                card.CardTime   = (DateTime)dr["cardTime"];
                card.CustomerID = (int)dr["customerID"];
                double total = 0;
                ValidateUtility.getDouble(dr, "total", out total);
                card.Total        = total;
                card.Number       = (int)dr["num"];
                card.LeftNumber   = (int)dr["leftNum"];
                card.Comment      = dr["Card.comment"] as string;
                card.Oper         = dr["operator"] as string;
                card.Status       = (int)dr["status"];
                card.Type         = (int)dr["type"];
                card.CustomerName = dr["name"] as string;

                return(card);
            }
            return(null);
        }
Beispiel #4
0
        private bool getProduct(out ProductStainless product)
        {
            double price_purchase, price_sell, price_cost, num, quantityPerPiece;
            string name;
            int    categoryID;

            if (ValidateUtility.getName(this.textBox_name, this.errorProvider1, out name) &&
                ValidateUtility.getDouble(this.textBox_purchasePrice, this.errorProvider1, true, true, out price_purchase) &&
                ValidateUtility.getDouble(this.textBox_sellPrice, this.errorProvider1, true, true, out price_sell) &&
                ValidateUtility.getDouble(this.textBox_cost, this.errorProvider1, false, false, out price_cost) &&
                ValidateUtility.getDouble(this.textBox_quantityPerPiece, this.errorProvider1, false, true, out quantityPerPiece) &&
                ValidateUtility.getDouble(this.textBox_libNum, this.errorProvider1, false, false, out num) &&
                this.getCategoryID(out categoryID))
            {
                product    = new ProductStainless(this.textBox_serial.Text, name, categoryID, price_purchase, price_sell, this.comboBox_unit.Text, quantityPerPiece, this.textBox_comment.Text, this.radioButton2.Checked);
                product.ID = productID;
                //2018-4-16修正bug
                product.PriceCost = price_cost;
                product.Num       = num;
                return(true);
            }
            else
            {
                product = null;
                return(false);
            }
        }
        /// <summary>
        /// 编辑区域元素验证
        /// </summary>
        /// <returns></returns>
        private bool VerifyEditField()
        {
            //收文日期
            if (txtReceiveDate.Text.TrimEnd() != String.Empty && !ValidateUtility.IsDateTime(txtReceiveDate.Text.TrimEnd()))
            {
                txtReceiveDate.Focus();
                return(false);
            }

            //行文日期
            if (txtXingWenDate.Text.TrimEnd() != String.Empty && !ValidateUtility.IsDateTime(txtXingWenDate.Text.TrimEnd()))
            {
                txtXingWenDate.Focus();
                return(false);
            }

            //形成日期
            if (txtFormationDate.Text.TrimEnd() != String.Empty && !ValidateUtility.IsDateTime(txtFormationDate.Text.TrimEnd()))
            {
                txtFormationDate.Focus();
                return(false);
            }

            //页数
            if (txtPageCount.Text.TrimEnd() != String.Empty && !ValidateUtility.IsInt(txtPageCount.Text.TrimEnd()))
            {
                txtPageCount.Focus();
                return(false);
            }

            return(true);
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            B_HSEdit    l_BusReceiveEdit  = null;
            B_Circulate l_BusCirculate    = null;
            DataTable   l_dtbCirculate    = null;
            DataTable   l_dtbProcessSteps = null;
            String      l_strRegisterID   = null;

            B_LetterReceive l_objWorkItem = null;

            WFBaseProcessInstance l_objProcessInstance = null;

            if (!Page.IsPostBack)
            {
                this.ucAttachment.UCIsEditable = false;

                PreviousPageUrl     = Request.UrlReferrer.ToString();
                l_strRegisterID     = Request.QueryString[ConstString.QueryString.REGISTER_ID];
                l_BusReceiveEdit    = new B_HSEdit();
                l_BusReceiveEdit.ID = Convert.ToInt32(l_strRegisterID);

                if (l_BusReceiveEdit == null)
                {
                    ValidateUtility.ShowMsgBox(this.Page, FS.ADIM.OA.BLL.Common.Utility.MessageType.VbCritical, "当前的ID或者无效,或者已经被删除!");
                    return;
                }

                this.ucAttachment.UCTemplateName = l_BusReceiveEdit.ProcessName;

                PopulateField(l_BusReceiveEdit);

                if (String.IsNullOrEmpty(l_BusReceiveEdit.ProcessID))
                {
                    divPrompt.Visible = true;
                    return;
                }
                l_objProcessInstance = FS.OA.Framework.WorkFlow.WFFactory.GetWF(FS.OA.Framework.WorkFlow.WFType.AgilePoint).GetAPI().GetProcInst(l_BusReceiveEdit.ProcessID);

                if (l_objProcessInstance != null)
                {
                    m_strProcessTemplate = l_objProcessInstance.DefName;

                    String l_strCirculateTableName = FS.ADIM.OA.BLL.Common.TableName.GetCirculateTableName(l_objProcessInstance.DefName);
                    l_BusCirculate          = new B_Circulate(l_strCirculateTableName);
                    l_dtbCirculate          = l_BusCirculate.GetCirculatesByID(l_strCirculateTableName, l_BusReceiveEdit.ProcessID, 0);
                    gdvCirculate.DataSource = l_dtbCirculate;
                    gdvCirculate.DataBind();

                    l_objWorkItem = new B_LetterReceive();

                    l_dtbProcessSteps = l_objWorkItem.GetStepsByProcessID(l_BusReceiveEdit.ProcessID, TableName.WorkItemsTableName.T_OA_HS_WorkItems + ((l_objProcessInstance.Status == ProcessConstString.ProcessStatus.STATUS_COMPLETED || l_objProcessInstance.Status == ProcessConstString.ProcessStatus.STATUS_CANCELED) ? "_BAK" : ""));

                    DataView l_dtvDataView = new DataView(l_dtbProcessSteps);
                    l_dtvDataView.RowFilter = "D_StepStatus = 'Completed'";

                    rptProcessDetail.DataSource = l_dtvDataView;
                    rptProcessDetail.DataBind();
                }
            }
        }
        /// <summary>
        /// 修改按钮处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnModify_Click(object sender, EventArgs e)
        {
            B_HSEdit l_BusReceiveEdit = null;

            if (String.IsNullOrEmpty(txtDocumentNo.Text.TrimEnd()))
            {
                ValidateUtility.ShowMsgBox(this.Page, FS.ADIM.OA.BLL.Common.Utility.MessageType.VbExclamation, "请先选择一条收文记录!");
                return;
            }

            if (!VerifyEditField())
            {
                ValidateUtility.ShowMsgBox(this.Page, FS.ADIM.OA.BLL.Common.Utility.MessageType.VbCritical, "表单验证失败");
                return;
            }

            l_BusReceiveEdit    = new B_HSEdit();
            l_BusReceiveEdit.ID = Convert.ToInt32(txtRegisterID.Text);

            if (l_BusReceiveEdit.CreateDate == DateTime.MinValue)
            {
                ValidateUtility.ShowMsgBox(this.Page, FS.ADIM.OA.BLL.Common.Utility.MessageType.VbCritical, "当前收文登记信息已经被删除,不能做修改动作!");
                return;
            }

            PopulateEntity(l_BusReceiveEdit);

            if (l_BusReceiveEdit.Save())
            {
                ValidateUtility.ShowMsgBox(this.Page, FS.ADIM.OA.BLL.Common.Utility.MessageType.VbInformation, "保存成功");
                PopulateEditField(l_BusReceiveEdit);
                LoadRegisterList();
            }
        }
Beispiel #8
0
        /// <summary>
        /// 雷射預設控制開關: 1.LSR雷射狀態,2.SHT遮光閥狀態
        /// </summary>
        private void DefultLaserControll()
        {
            string cmd = string.Empty; string response = string.Empty;

            if (formStartModel.LSR雷射狀態 == "0")
            {
                cmd      = LaserCommand.LSR激光控制設定("1");
                response = LaserExecuteWrite.執行LSR激光控制設定(cmd);
                if (ValidateUtility.DisplayMessage(response))
                {
                    return;
                }
                LaserReady laserReady = new LaserReady();
                laserReady.ShowDialog();
                formStartModel.LSR雷射狀態 = "1";
            }

            if (formStartModel.SHT遮光閥狀態 == "0")
            {
                cmd      = LaserCommand.SHT遮光閥控制設定("1");
                response = LaserExecuteWrite.執行SHT遮光閥控制設定(cmd);
                if (ValidateUtility.DisplayMessage(response))
                {
                    return;
                }
                formStartModel.SHT遮光閥狀態 = "1";
            }
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        public BaseWcfService()
        {
            var httpContext = HttpContext.Current;

            if (httpContext != null)
            {
                var args = httpContext.Request.Url.Segments;
                for (var i = 0; i < args.Length; i++)
                {
                    args[i] = ValidateUtility.CheckNull(args[i].Trim(new char[] { '/', '\\', ' ' })).ToString();
                }
                if (args.Length >= 8)
                {
                    SystemType = MCvHelper.To <SystemType>(args[3]);
                    Token      = MCvHelper.To <string>(args[4]);
                    Guid       = MCvHelper.To <string>(args[5]);
                    UserId     = MCvHelper.To <int>(args[6]);
                    Uid        = MCvHelper.To <string>(args[7]);
                }
                else
                {
                    MLogManager.Error(MLogGroup.WcfService.构造函数, "", "wcf 服务基类 构造函数初始化 ,uri参数错误");
                }
            }
        }
Beispiel #10
0
        public void ToIdExists_False()
        {
            MockTodoRepository mockObj    = new MockTodoRepository();
            List <ToDo>        getAllTodo = mockObj.getAllTodo();
            bool isExist = ValidateUtility.ToDoIdExists(getAllTodo, 12);

            Assert.AreEqual(false, isExist);
        }
        public void Test_ToDoExists_False()
        {
            MockTodoRepository mockToDoObj = new MockTodoRepository();
            ToDoController     tc          = new ToDoController(mockToDoObj);
            bool apiResponse = ValidateUtility.ToDoIdExists(TodoTestData.GetMockAllToDo(), 50);

            Assert.IsFalse(apiResponse);
        }
Beispiel #12
0
        //get and set api
        protected bool getCard(out Card c)
        {
            //先获取status
            int tempStatus = 1;

            if (card != null)
            {
                tempStatus = card.Status;
            }

            c = new Card();

            c.Status = tempStatus;

            c.ID = cardID;

            string code;

            if (ValidateUtility.getName(this.textBox_serial, this.errorProvider1, out code) == false)
            {
                return(false);
            }
            c.Code = code;

            int customerID = -1;

            if (this.lookupText1.Visible == true && ValidateUtility.getLookupValueID(this.lookupText1, this.errorProvider1, out customerID) == false)
            {
                return(false);
            }

            c.CustomerID = customerID;

            c.CardTime = this.dateTime_cardTime.Value;
            c.Comment  = this.textBox_comment.Text;
            c.Oper     = this.textBox_operator.Text;


            c.CustomerName = this.lookupText1.Text_Lookup;

            double total;
            int    num, leftNum;

            if (ValidateUtility.getDouble(this.textBox_realTotal, this.errorProvider1, true, true, out total) &&
                ValidateUtility.getInt(this.textBox_num, this.errorProvider1, true, true, out num) &&
                ValidateUtility.getInt(this.textBox_leftNum, this.errorProvider1, true, true, out leftNum))
            {
                c.Total      = total;
                c.Number     = num;
                c.LeftNumber = leftNum;
            }
            else
            {
                return(false);
            }
            return(true);
        }
 /// <summary>
 /// 详细信息按钮处理
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnDetail_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(txtDocumentNo.Text.TrimEnd()))
     {
         ValidateUtility.ShowMsgBox(this.Page, FS.ADIM.OA.BLL.Common.Utility.MessageType.VbExclamation, "请先选择一条收文记录!");
         return;
     }
     Response.Redirect("Container.aspx?ClassName=FS.ADIM.OA.WebUI.WorkFlow.Receive.ReDetail.PG_HSReDetail&" + ConstString.QueryString.REGISTER_ID + "=" + Convert.ToString(txtRegisterID.Text), true);
 }
        /// <summary>
        /// set datagridview value
        /// </summary>
        /// <param name="rowIndex"></param>
        protected virtual void setSubTotalPrice(int rowIndex)
        {
            DataGridViewRow row = this.dataGridView1.Rows[rowIndex];
            double          price, num;

            ValidateUtility.getDouble(row.Cells["price"], out price);
            ValidateUtility.getDouble(row.Cells["num"], false, true, out num);
            row.Cells["totalPrice"].Value = num * price;
        }
        protected override bool getRecords(out List <ProductCirculationRecord> records)
        {
            records = new List <ProductCirculationRecord>();

            int number = this.dataGridView1.RowCount;

            double num, price, totalPrice, quantityPerPiece;
            int    pieces;
            bool   isQuantityNull = false, isPiecesNull = false;
            string unit, comment;
            bool   isInputCorrect = true;

            foreach (DataGridViewRow row in this.dataGridView1.Rows)
            {
                object productID = null;
                int    ID        = 0;
                if (ValidateUtility.getLookupValue(row.Cells["product"], out productID) == false ||
                    ValidateUtility.getInt(row.Cells["ID"], false, true, out ID) == false ||
                    ValidateUtility.getDouble(row.Cells["quantityPerPiece"], false, true, out quantityPerPiece, out isQuantityNull) == false ||
                    ValidateUtility.getInt(row.Cells["pieces"], false, true, out pieces, out isPiecesNull) == false ||
                    ValidateUtility.getDouble(row.Cells["num"], true, true, out num) == false ||
                    ValidateUtility.getString(row.Cells["unit"], false, out unit) == false ||
                    ValidateUtility.getDouble(row.Cells["price"], out price) == false ||
                    ValidateUtility.getDouble(row.Cells["totalPrice"], out totalPrice) == false ||
                    ValidateUtility.getString(row.Cells["comment"], false, out comment) == false)
                {
                    return(false);
                }
                ProductStainlessCirculationRecord record = new ProductStainlessCirculationRecord();

                LookupArg arg = ((row.Cells["product"] as DataGridViewLookupCell).EditedValue as LookupArg);
                record.ProductID   = (int)arg.Value;
                record.ProductName = arg.Text;

                record.ID = ID;

                string serial;
                ValidateUtility.getString(row.Cells["serial"], false, out serial);
                record.Serial = serial;

                record.QuantityPerPiece = quantityPerPiece;
                record.QuantityNull     = isQuantityNull;

                record.Pieces     = pieces;
                record.PiecesNull = isPiecesNull;

                record.TotalNum   = num;
                record.Unit       = unit;
                record.Price      = price;
                record.TotalPrice = totalPrice;
                record.Comment    = comment;

                records.Add(record);
            }

            return(isInputCorrect);
        }
Beispiel #16
0
        public void ValidateInput_Not_Empty()
        {
            ToDo toDoITem = new ToDo {
                SlNo = 1, Item = "Item1", Description = "Desc Item1"
            };
            List <Error> lstValidateInput = ValidateUtility.ValidateInput(toDoITem);

            Assert.IsTrue(lstValidateInput.Count == 0);
        }
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            if (!VerifyQueryField())
            {
                ValidateUtility.ShowMsgBox(this.Page, FS.ADIM.OA.BLL.Common.Utility.MessageType.VbCritical, "表单验证失败");
                return;
            }

            LoadRegisterList();
        }
Beispiel #18
0
 /// <summary>
 /// event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripButton3_Click(object sender, EventArgs e)
 {
     string path = null;
     if (ValidateUtility.getName(this.textBox_oldPs, this.errorProvider1, out path) == false)
         return;
     ConfDao.getInstance().Update(13, path);
     MessageBox.Show("保存路径成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     this.Close();
     
 }
Beispiel #19
0
        /// <summary>
        /// 驗證欄位參數是否有空白值,
        /// </summary>
        /// <returns></returns>
        private bool CheckValueEmpty()
        {
            string        result    = string.Empty;
            List <string> parameter = new List <string> {
                { txtNo.Text }, { txtPassword.Text }
            };

            result = ValidateUtility.CheckParameter(parameter);
            return(ValidateUtility.DisplayMessage(result));
        }
Beispiel #20
0
        public void ValidateInput_Description_Empty()
        {
            ToDo toDoITem = new ToDo {
                SlNo = 1, Item = "Item1", Description = ""
            };
            List <Error> lstValidateInput = ValidateUtility.ValidateInput(toDoITem);

            Assert.IsTrue(lstValidateInput.Count == 1);
            Assert.AreEqual(AppConstants.DESCRIPTION_EMPTY, lstValidateInput[0].errorCode);
            Assert.AreEqual(AppConstants.DESCRIPTION_EMPTY_MSG, lstValidateInput[0].errorMessage);
        }
Beispiel #21
0
        /// <summary>
        /// 雷射打印,[DM_8111允許手動][DM_8214手動打印通知]
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripbtnPoint_Click(object sender, EventArgs e)
        {
            toolStripbtnSet.Enabled   = true;
            toolStripbtnPoint.Enabled = false;

            try
            {
                // 異動紀錄
                AddRecChangeMethod("手動流程:雷射打印執行");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            if (GlobalParameter.UseMode.Equals("0"))
            {
                MessageBox.Show("測試模式,無法雷射打印。"); return;
            }
            try
            {
                if (GlobalData.PLC線路異常)
                {
                    MessageBox.Show("PLC線路異常。"); return;
                }
                if (GlobalData.DM[DmTable.DM_8111允許手動] != "1")
                {
                    MessageBox.Show("PLC讀取異常[DM_8111允許手動]:不允許手動,請檢查PLC參數。");
                    return;
                }

                if (SHT遮光閥狀態 == "0")
                {
                    string cmd      = LaserCommand.MKM指令接收控制設定("1");
                    string response = LaserExecuteWrite.執行MRK印字觸控制設定(cmd);
                    if (ValidateUtility.DisplayMessage(response))
                    {
                        return;
                    }
                    SHT遮光閥狀態 = "1";
                }

                PLCcommand.PLC_Write(PLCcommand.Cmd_Mode.Mode_Write_Single,
                                     PLCcommand.PLC_IO.DM, DmTable.DM_8214手動打印通知, 1, 0, null);
                formStartModel.允許雷射打印Tag = true;
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception錯誤");
                MessageBox.Show("Exception_PLC系統異常錯誤:" + ex.Message);
                return;
            }
        }
        /// <summary>
        /// 查询按钮的处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            B_ReceiveEdit l_BusReceiveEdit = null;

            if (!VerifyQueryField())
            {
                ValidateUtility.ShowMsgBox(this.Page, FS.ADIM.OA.BLL.Common.Utility.MessageType.VbCritical, "表单验证失败");
                return;
            }

            l_BusReceiveEdit = new B_ReceiveEdit();

            l_BusReceiveEdit.ProcessName = ProcessTemplate;

            //收文号-从
            l_BusReceiveEdit.ReceiveNoFrom = txtQueryDocNoFrom.Text.TrimEnd();

            //收文号-到
            l_BusReceiveEdit.ReceiveNoTo = txtQueryDocNoTo.Text.TrimEnd();

            //文件标题
            l_BusReceiveEdit.DocumentTitle = txtQueryDocTitle.Text.TrimEnd();

            //收文日期-从
            if (ValidateUtility.IsDateTime(txtQueryRecDateFrom.Text.TrimEnd()))
            {
                l_BusReceiveEdit.ReceiveDateFrom = txtQueryRecDateFrom.ValDate;
            }

            //收文日期-到
            if (ValidateUtility.IsDateTime(txtQueryRecDateTo.Text.TrimEnd()))
            {
                l_BusReceiveEdit.ReceiveDateTo = txtQueryRecDateTo.ValDate;
            }

            //来文单位
            l_BusReceiveEdit.ReceiveUnit = txtQueryRecUnit.Text.TrimEnd();

            //收文年份
            l_BusReceiveEdit.ReceiveYear = ddlQueryRecYear.Text.TrimEnd();

            //状态
            if (ddlQueryStatus.SelectedItem != null)
            {
                l_BusReceiveEdit.Status = ddlQueryStatus.SelectedItem.Text;
            }
            l_BusReceiveEdit.Start = this.gdvList.PageIndex * this.gdvList.PageSize;
            l_BusReceiveEdit.End   = this.gdvList.PageIndex * this.gdvList.PageSize + this.gdvList.PageSize;
            l_BusReceiveEdit.Sort  = null;

            this.gdvList.DataSource  = l_BusReceiveEdit.QueryRegisterInfo(l_BusReceiveEdit);
            this.gdvList.RecordCount = l_BusReceiveEdit.RowCount;
            this.gdvList.DataBind();
        }
Beispiel #23
0
        public void ToDoExists_True()
        {
            ToDo toDoITem = new ToDo {
                SlNo = 1, Item = "Item1", Description = "Desc Item1"
            };
            MockTodoRepository mockObj    = new MockTodoRepository();
            List <ToDo>        getAllTodo = mockObj.getAllTodo();

            bool isExist = ValidateUtility.ToDoExists(getAllTodo, toDoITem);

            Assert.AreEqual(true, isExist);
        }
Beispiel #24
0
        public override List <ProductCirculationRecord> FindList(int circulationID)
        {
            List <ProductCirculationRecord> records = new List <ProductCirculationRecord>();

            string    commandText = string.Format("select * from ProductStainlessCirculationRecord, ProductStainless where ProductStainlessCirculationRecord.productID = ProductStainless.ID and circulationID = {0} order by ProductStainlessCirculationRecord.ID", circulationID);
            DataTable dt          = DbHelperAccess.executeQuery(commandText);

            foreach (DataRow dr in dt.Rows)
            {
                bool tempBool = false;

                ProductStainlessCirculationRecord record = new ProductStainlessCirculationRecord();
                record.CirculationID = circulationID;
                record.ID            = (int)dr["ProductStainlessCirculationRecord.ID"];

                int    pieces;
                double price, totalPrice, quantityPerPiece;

                double.TryParse(dr["price"].ToString(), out price);
                record.Price = price;

                record.Serial      = dr["serial"].ToString();
                record.ProductID   = (int)dr["ProductStainless.ID"];
                record.ProductName = dr["name"].ToString();

                ValidateUtility.getDouble(dr, "ProductStainlessCirculationRecord.quantityPerPiece", out quantityPerPiece, out tempBool);
                record.QuantityPerPiece = quantityPerPiece;
                record.QuantityNull     = tempBool;

                ValidateUtility.getInt(dr, "pieces", out pieces, out tempBool);
                record.Pieces     = pieces;
                record.PiecesNull = tempBool;

                record.Unit = dr["ProductStainlessCirculationRecord.unit"].ToString();

                double num;
                ValidateUtility.getDouble(dr, "totalNum", out num, out tempBool);
                record.TotalNum = num;

                ValidateUtility.getDouble(dr, "totalPrice", out totalPrice, out tempBool);
                record.TotalPrice = totalPrice;

                record.Comment = dr["ProductStainlessCirculationRecord.comment"].ToString();

                records.Add(record);
            }
            return(records);
        }
Beispiel #25
0
        private void button_save_Click(object sender, EventArgs e)
        {
            if (this.needSave == true)
            {
                //List<CharactorValue> values = new List<CharactorValue>();
                foreach (DataGridViewRow row in this.dataGridView1.Rows)
                {
                    CharactorValue value = new CharactorValue();
                    string         name  = null;
                    if (ValidateUtility.getString(row.Cells["name"], true, out name) == false)
                    {
                        return;
                    }
                    value.Name        = name;
                    value.CharactorId = charactorId;

                    object id = row.Cells["ID"].Value;
                    if (id == null || id.ToString() == "")
                    {
                        value.Id = -1;
                        int idReturn = CharactorValueDao.getInstance().Insert(value);
                        row.Cells["ID"].Value = idReturn;
                    }
                    else
                    {
                        value.Id = int.Parse(id.ToString());
                        CharactorValueDao.getInstance().Update(value);
                    }

                    //values.Add(value);
                }

                /*
                 * foreach (CharactorValue value in values) {
                 *  if (value.Id <= 0)
                 *      CharactorValueDao.getInstance().Insert(value);
                 *  else
                 *      CharactorValueDao.getInstance().Update(value);
                 * }*/

                this.modify = true;

                this.needSave            = false;
                this.button_save.Enabled = false;

                MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #26
0
        private void 雷射動作執行緒(object obj)
        {
            while (true)
            {
                if (GlobalData.DM[DmTable.DM_8123雷射打印開始].Equals("1"))
                {
                    if (formStartModel.允許雷射打印Tag)
                    {
                        if (GlobalData.DM[DmTable.DM_8104停止].Equals("1") || GlobalData.DM[DmTable.DM_8110結批].Equals("1"))
                        {
                            lblAutoRun.Text         = "停止運轉";
                            splitContainer1.Enabled = true;
                        }
                        else
                        {
                            string cmd = string.Empty, response = string.Empty;
                            Thread.Sleep(200);
                            if (formStartModel.SHT遮光閥狀態.Equals("0"))
                            {
                                cmd      = LaserCommand.MKM指令接收控制設定("1");
                                response = LaserExecuteWrite.執行MRK印字觸控制設定(cmd);
                                if (ValidateUtility.DisplayMessage(response))
                                {
                                    return;
                                }
                                formStartModel.SHT遮光閥狀態 = "1";
                            }

                            Thread.Sleep(200);
                            cmd      = LaserCommand.MRK印字觸控制設定("1");
                            response = LaserExecuteWrite.執行MRK印字觸控制設定(cmd);
                            int dm = ValidateUtility.DisplayMessage(response).Equals(true) ?
                                     DmTable.DM_8230雷射打印異常 : DmTable.DM_8229雷射打印完畢;
                            PLCMethod.WriteSingle(dm, 1);
                        }
                    }
                    else
                    {
                        PLCMethod.WriteSingle(DmTable.DM_8229雷射打印完畢, 1);
                    }

                    // PLC:DM_8123雷射打印開始,清空點位
                    PLCMethod.WriteSingle(DmTable.DM_8123雷射打印開始, 0);
                }

                Thread.Sleep(100);
            }
        }
        /// <summary>
        /// 查询区块元素验证
        /// </summary>
        /// <returns></returns>
        private bool VerifyQueryField()
        {
            //收文日期-从
            if (!String.IsNullOrEmpty(txtQueryRecDateFrom.Text.TrimEnd()) && !ValidateUtility.IsDateTime(txtQueryRecDateFrom.Text.TrimEnd()))
            {
                return(false);
            }

            //收文日期-到
            if (!String.IsNullOrEmpty(txtQueryRecDateTo.Text.TrimEnd()) && !ValidateUtility.IsDateTime(txtQueryRecDateTo.Text.TrimEnd()))
            {
                return(false);
            }

            return(true);
        }
Beispiel #28
0
        public override void initRecords(DataGridView dataGridView1, DataTable dataTable)
        {
            dataGridView1.Rows.Clear();
            double sumToPay = 0, sumToRecepit = 0;
            int    index = 0;

            foreach (DataRow dr in dataTable.Rows)
            {
                index = dataGridView1.Rows.Add();
                dataGridView1.Rows[index].Cells["ID"].Value       = dr["Customer.ID"];
                dataGridView1.Rows[index].Cells["name"].Value     = dr["Customer.name"];
                dataGridView1.Rows[index].Cells["category"].Value = dr["CustomerCategory.name"];
                double arrear = 0;
                bool   temp;
                ValidateUtility.getDouble(dr, "arrear", out arrear, out temp);
                if (arrear > 0)
                {
                    dataGridView1.Rows[index].Cells["myArrear"].Style.ForeColor          = Color.Green;
                    dataGridView1.Rows[index].Cells["myArrear"].Style.SelectionForeColor = Color.Green;
                    dataGridView1.Rows[index].Cells["myArrear"].Value = string.Format("{0:0.00}", arrear);
                    sumToPay += arrear;
                }
                else if (arrear < 0)
                {
                    dataGridView1.Rows[index].Cells["hisArrear"].Style.ForeColor          = Color.Red;
                    dataGridView1.Rows[index].Cells["hisArrear"].Style.SelectionForeColor = Color.Red;
                    dataGridView1.Rows[index].Cells["hisArrear"].Value = string.Format("{0:0.00}", -arrear);
                    sumToRecepit += (-arrear);
                }
            }

            index = dataGridView1.Rows.Add();

            dataGridView1.Rows[index].Cells["name"].Value = "合计";

            dataGridView1.Rows[index].Cells["myArrear"].Style.ForeColor          = Color.Green;
            dataGridView1.Rows[index].Cells["myArrear"].Style.SelectionForeColor = Color.Green;
            dataGridView1.Rows[index].Cells["myArrear"].Value = string.Format("{0:0.00}", sumToPay);

            dataGridView1.Rows[index].Cells["hisArrear"].Style.ForeColor          = Color.Red;
            dataGridView1.Rows[index].Cells["hisArrear"].Style.SelectionForeColor = Color.Red;
            dataGridView1.Rows[index].Cells["hisArrear"].Value = string.Format("{0:0.00}", sumToRecepit);

            dataGridView1.Rows[index].DefaultCellStyle.ForeColor = Color.Red;
            dataGridView1.Rows[index].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.Rows[index].DefaultCellStyle.Font      = new Font("宋体", 10F, FontStyle.Bold);
        }
        //这个函数是更新下cutoff
        private void textBox_realTotal_TextChanged(object sender, EventArgs e)
        {
            this.realTotalNeedRecaculate = false;
            if (this.cutoffNeedReCaculate == true)
            {
                double realTotal = 0, total = 0, totalBackFreight = 0;
                double.TryParse(this.textBox_realTotal.Text, out realTotal);
                double.TryParse(this.label_totalBackFreight.Text, out totalBackFreight);

                ValidateUtility.getDouble(this.dataGridView2[1, 0], out total);
                if (total != 0)
                {
                    this.textBox_cutoff.Text = string.Format("{0}", (realTotal + totalBackFreight) / total * 100);
                }
            }
            this.realTotalNeedRecaculate = true;
        }
        protected override void setSubTotalPrice(int rowIndex)
        {
            DataGridViewRow row = this.dataGridView1.Rows[rowIndex];
            double          price;
            double          num = 0;

            ValidateUtility.getDouble(row.Cells["price"], out price);
            try
            {
                object temp = (row.Cells["num"] as DataGridViewLookupCell).EditedValue;
                num = ((temp as LookupArg).Value as ProductCirculationRecord).TotalNum;
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
            row.Cells["totalPrice"].Value = num * price;
        }