/// <summary> /// 读取控件参数值 /// </summary> private void ReadFieldValue() { if (mlBackUpConfigID > 0) { DataTable dtBackUp = ExecuteSQL.CallView(108, "", "BackUpConfigID=" + mlBackUpConfigID, ""); if (dtBackUp.Rows.Count > 0) { DataRow drBackUp = dtBackUp.Rows[0]; int iBackUpType = LBConverter.ToInt32(drBackUp["BackUpType"]); int iBackUpWeek = LBConverter.ToInt32(drBackUp["BackUpWeek"]); int iBackUpHour = LBConverter.ToInt32(drBackUp["BackUpHour"]); int iBackUpMinu = LBConverter.ToInt32(drBackUp["BackUpMinu"]); bool bolIsEffect = LBConverter.ToBoolean(drBackUp["IsEffect"]); int iBackUpFileMaxNum = LBConverter.ToInt32(drBackUp["BackUpFileMaxNum"]); string strBackUpPath = LBConverter.ToString(drBackUp["BackUpPath"]); string strBackUpName = LBConverter.ToString(drBackUp["BackUpName"]); this.txtBackUpFileMaxNum.Text = iBackUpFileMaxNum.ToString(); this.txtBackUpHour.Text = iBackUpHour.ToString(); this.txtBackUpMinu.Text = iBackUpMinu.ToString(); this.txtBackUpWeek.SelectedValue = iBackUpWeek; this.txtBackUpType.SelectedValue = iBackUpType; this.txtBackUpName.Text = strBackUpName; this.chkIsEffect.Checked = bolIsEffect; } } }
/// <summary> /// 读取控件参数值 /// </summary> private void ReadFieldValue() { if (mlItemID > 0) { DataTable dtBackUp = ExecuteSQL.CallView(203, "", "ItemID=" + mlItemID, ""); if (dtBackUp.Rows.Count > 0) { DataRow dr = dtBackUp.Rows[0]; string strItemCode = LBConverter.ToString(dr["ItemCode"]); string strK3ItemCode = LBConverter.ToString(dr["K3ItemCode"]); string strItemName = LBConverter.ToString(dr["ItemName"]); string strItemMode = LBConverter.ToString(dr["ItemMode"]); decimal dItemRate = LBConverter.ToDecimal(dr["ItemRate"]); long lUOMID = LBConverter.ToInt32(dr["UOMID"]); long lItemTypeID = LBConverter.ToInt32(dr["ItemTypeID"]); string strDescription = LBConverter.ToString(dr["Description"]); bool bIsForbid = LBConverter.ToBoolean(dr["IsForbid"]); decimal decprice = LBConverter.ToDecimal(dr["ItemPrice"]); this.txtK3ItemCode.Text = strK3ItemCode; this.txtItemCode.Text = strItemCode; this.txtItemName.Text = strItemName; this.txtItemMode.Text = strItemMode; this.txtItemRate.Text = dItemRate.ToString(); this.txtUOMID.SelectedValue = lUOMID; this.txtItemTypeID.SelectedValue = lItemTypeID; this.txtDescription.Text = strDescription; this.chkIsForbid.Checked = bIsForbid; this.txtPrice.Text = decprice.ToString("0.000"); } } }
private void ReadFieldValue() { if (mlReceiveBillHeaderID > 0) { DataTable dtHeader = ExecuteSQL.CallView(111, "", "ReceiveBillHeaderID=" + mlReceiveBillHeaderID, ""); if (dtHeader.Rows.Count > 0) { DataRow drHeader = dtHeader.Rows[0]; bool bolIsApprove = LBConverter.ToBoolean(drHeader["IsApprove"]); bool bolIsCancel = LBConverter.ToBoolean(drHeader["IsCancel"]); decimal decReceiveAmount = LBConverter.ToDecimal(drHeader["ReceiveAmount"]); decimal decSalesReceiveAmountAdd = LBConverter.ToDecimal(drHeader["SalesReceiveAmountAdd"]); decimal decSalesReceiveAmountReduce = LBConverter.ToDecimal(drHeader["SalesReceiveAmountReduce"]); decimal decOriginalAmount = LBConverter.ToDecimal(drHeader["OriginalAmount"]); this.txtBillDate.Text = LBConverter.ToString(drHeader["BillDate"]); this.txtBillStatus.Text = bolIsApprove?"已审核": (bolIsCancel?"已作废":("未审核")); this.txtCustomerID.TextBox.SelectedItemID = drHeader["CustomerID"].ToString(); this.txtDescription.Text = drHeader["Description"].ToString(); this.txtReceiveAmount.Text = decReceiveAmount.ToString("N0"); this.txtReceiveBillCode.Text = drHeader["ReceiveBillCode"].ToString(); this.txtChangedBy.Text = drHeader["ChangedBy"].ToString(); this.txtChangeTime.Text = drHeader["ChangeTime"].ToString(); this.txtApproveBy.Text = drHeader["ApproveBy"].ToString(); this.txtApproveTime.Text = drHeader["ApproveTime"].ToString(); this.txtCancelBy.Text = drHeader["CancelBy"].ToString(); this.txtCancelTime.Text = drHeader["CancelTime"].ToString(); this.txtRPReceiveType.TextBox.SelectedItemID = drHeader["ChargeTypeID"]; this.txtReceiveBankID.TextBox.SelectedItemID = drHeader["ReceiveBankID"]; } } }
//选择车辆触发事件 private void CarTextBox_TextChanged(object sender, EventArgs e) { try { string strCarNum = this.txtCarID.TextBox.Text.ToString(); long lCarID = 0; decimal decDefaultCarWeight = 0; #region -- 读取车辆ID号 -- using (DataTable dtCar = ExecuteSQL.CallView(117, "CarID,SupplierID,DefaultCarWeight", "CarNum='" + strCarNum + "'", "")) { if (dtCar.Rows.Count > 0) { lCarID = LBConverter.ToInt64(dtCar.Rows[0]["CarID"]); decDefaultCarWeight = LBConverter.ToInt64(dtCar.Rows[0]["DefaultCarWeight"]); } } #endregion -- 读取车辆ID号 -- if (lCarID > 0)//如果存在该车辆 { this.txtCarTare.Text = LBConverter.ToString(decDefaultCarWeight); } else { this.txtCarTare.Text = ""; } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
/// <summary> /// 读取控件参数值 /// </summary> private void ReadFieldValue() { if (mlReportViewID > 0) { DataTable dt = ExecuteSQL.CallView(132, "", "ReportViewID=" + mlReportViewID, ""); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; this.txtReportViewName.Text = LBConverter.ToString(dr["ReportViewName"]); this.txtReportDataSource.Text = LBConverter.ToString(dr["ReportDataSource"]); } } }
/// <summary> /// 读取控件参数值 /// </summary> private void ReadFieldValue() { if (mlUOMID > 0) { string strSQL = "select * from dbo.DbUOM where UOMID=" + mlUOMID; DataTable dt = ExecuteSQL.CallDirectSQL(strSQL); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; this.txtUOMName.Text = LBConverter.ToString(dr["UOMName"]); this.txtUOMType.SelectedValue = dr["UOMType"]; } } }
/// <summary> /// 读取控件参数值 /// </summary> private void ReadFieldValue() { if (mlItemTypeID > 0) { string strSQL = "select * from dbo.DbItemType where ItemTypeID=" + mlItemTypeID; DataTable dt = ExecuteSQL.CallDirectSQL(strSQL); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; this.txtItemTypeName.Text = LBConverter.ToString(dr["ItemTypeName"]); this.txtChangeBy.Text = LBConverter.ToString(dr["ChangeBy"]); this.txtChangeTime.Text = LBConverter.ToString(dr["ChangeTime"]); } } }
//选择车辆触发事件 private void CarTextBox_TextChanged(object sender, EventArgs e) { try { mlSaleCarInBillID = 0; string strCarNum = this.txtCarID.TextBox.Text.ToString(); long lCarID = 0; long lCustomerID = 0; #region -- 读取车辆ID号 -- using (DataTable dtCar = ExecuteSQL.CallView(117, "CarID,CustomerID", "CarNum='" + strCarNum + "'", "")) { if (dtCar.Rows.Count > 0) { lCarID = LBConverter.ToInt64(dtCar.Rows[0]["CarID"]); lCustomerID = LBConverter.ToInt64(dtCar.Rows[0]["CustomerID"]); } } #endregion -- 读取车辆ID号 -- if (lCarID > 0)//如果存在该车辆 { #region -- 判断该车辆是否已入场 -- bool bolExists = false; LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("CarID", enLBDbType.Int64, lCarID)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(14101, parmCol, out dsReturn, out dictValue); if (dictValue != null && dictValue.Keys.Count > 0) { if (dictValue.ContainsKey("IsReaded")) { bolExists = LBConverter.ToBoolean(dictValue["IsReaded"]); } if (bolExists) //已读取入场记录 { this.txtTotalWeight.Text = ""; //清空毛重 this.txtPrice.Text = ""; //清空单价 #region -- 读取入场记录,并将入场记录值填写到对应控件 -- if (dictValue.ContainsKey("CalculateType")) { this.txtCalculateType.SelectedValue = LBConverter.ToInt32(dictValue["CalculateType"]); } if (dictValue.ContainsKey("ItemID")) { this.txtItemID.TextBox.SelectedItemID = LBConverter.ToInt64(dictValue["ItemID"]); } if (dictValue.ContainsKey("CustomerID")) { this.txtCustomerID.TextBox.SelectedItemID = LBConverter.ToInt64(dictValue["CustomerID"]); } if (dictValue.ContainsKey("CarTare")) { this.txtCarTare.Text = LBConverter.ToString(dictValue["CarTare"]); } if (dictValue.ContainsKey("ReceiveType")) { this.txtReceiveType.SelectedValue = LBConverter.ToInt32(dictValue["ReceiveType"]); } if (dictValue.ContainsKey("SaleCarInBillID")) { mlSaleCarInBillID = LBConverter.ToInt64(dictValue["SaleCarInBillID"]); } //读取物料价格 ReadPrice(); #endregion -- 读取入场记录,并将入场记录值填写到对应控件 -- } else { #region -- 该车无入场记录 -- this.txtCustomerID.TextBox.Text = ""; this.txtItemID.TextBox.Text = ""; this.txtTotalWeight.Text = ""; this.txtPrice.Text = ""; #endregion -- 该车无入场记录 -- } } #endregion } else { this.txtCustomerID.TextBox.Text = ""; this.txtItemID.TextBox.Text = ""; this.txtTotalWeight.Text = ""; this.txtPrice.Text = ""; } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private static void MTimer_Elapsed(object sender, ElapsedEventArgs e) { try { string strSQL = "select * from dbo.DbBackUpConfig where IsEffect=1"; DataTable dtBackUpConfig = SQLServerDAL.Query(strSQL); //查询当日的备份清单 strSQL = "select * from dbo.DbBackUpLog where BackUpTime>='" + DateTime.Now.ToString("yyyy-MM-dd") + "'"; DataTable dtBackUpLog = SQLServerDAL.Query(strSQL); DataView dvBackUpLog = new DataView(dtBackUpLog); foreach (DataRow dr in dtBackUpConfig.Rows) { int iBackUpType = LBConverter.ToInt32(dr["BackUpType"]); int iBackUpWeek = LBConverter.ToInt32(dr["BackUpWeek"]); int iBackUpHour = LBConverter.ToInt32(dr["BackUpHour"]); int iBackUpMinu = LBConverter.ToInt32(dr["BackUpMinu"]); long lBackUpConfigID = LBConverter.ToInt64(dr["BackUpConfigID"]); string strBackUpName = LBConverter.ToString(dr["BackUpName"]); int iBackUpFileMaxNum = LBConverter.ToInt32(dr["BackUpFileMaxNum"]); DateTime now = DateTime.Now; int iWeek = (int)now.DayOfWeek; int iHour = now.Hour; int iMinu = now.Minute; if (iBackUpType == 0)//每周备份一次 { if (iWeek == iBackUpWeek) { if (iHour == iBackUpHour) { if (iMinu >= iBackUpMinu && iMinu <= iBackUpMinu + 29) { string strBackUpTimeFrom = DateTime.Now.ToString("yyyy-MM-dd ") + iBackUpHour + ":" + iBackUpMinu; string strBackUpTimeTo = DateTime.Now.ToString("yyyy-MM-dd ") + iBackUpHour + ":" + (iBackUpMinu + 29); dvBackUpLog.RowFilter = "BackUpConfigID=" + lBackUpConfigID + " and BackUpTime>='" + strBackUpTimeFrom + "' and BackUpTime<='" + strBackUpTimeTo + "'"; if (dvBackUpLog.Count == 0) { lock (mlstBackTask) { bool bolIsAdd = true; foreach (BackUpTask t in mlstBackTask) { if (t.BackUpConfigID == lBackUpConfigID) { bolIsAdd = false; break; } } if (bolIsAdd) { BackUpTask task = new BackUp.BackUpTask(lBackUpConfigID, strBackUpName, iBackUpFileMaxNum); mlstBackTask.Add(task); } } } } } } } else { //每日备份一次 if (iHour == iBackUpHour) { if (iMinu >= iBackUpMinu && iMinu <= iBackUpMinu + 29) { string strBackUpTimeFrom = DateTime.Now.ToString("yyyy-MM-dd ") + iBackUpHour + ":" + iBackUpMinu; string strBackUpTimeTo = DateTime.Now.ToString("yyyy-MM-dd ") + iBackUpHour + ":" + (iBackUpMinu + 29); dvBackUpLog.RowFilter = "BackUpConfigID=" + lBackUpConfigID + " and BackUpTime>='" + strBackUpTimeFrom + "' and BackUpTime<='" + strBackUpTimeTo + "'"; if (dvBackUpLog.Count == 0) { lock (mlstBackTask) { bool bolIsAdd = true; foreach (BackUpTask t in mlstBackTask) { if (t.BackUpConfigID == lBackUpConfigID) { bolIsAdd = false; break; } } if (bolIsAdd) { BackUpTask task = new BackUp.BackUpTask(lBackUpConfigID, strBackUpName, iBackUpFileMaxNum); mlstBackTask.Add(task); } } } } } } } } catch (Exception ex) { } }