public static DbDataReader GetLineRoadDesignDRByID(string lineRoadDesginID) { string sql = @"select * from LineRoadDesignDetail a,LineRoadDesign b where a.LineRoadDesignID=b.LineRoadDesignID and b.LineRoadDesignID='" + lineRoadDesginID + @"'"; var lrReader = DataAccessFactory.CreateDataAccess(DBConfigure.LJJSConfigureDb, DBConfigure.configConStr); return(lrReader.ExecuteReader(sql)); }
public static DbDataReader GetDefaultJingShenDesignDR() { string sql = "select * from JingShenDesign where ifDefault=1"; var lrReader = DataAccessFactory.CreateDataAccess(DBConfigure.LJJSConfigureDb, DBConfigure.configConStr); return(lrReader.ExecuteReader(sql)); }
private void btnQuery_Click(object sender, EventArgs e) { try { this.btnQuery.Enabled = false; DateTime d1 = new DateTime(this.myDateTimePicker1.Value.Year, this.myDateTimePicker1.Value.Month, 1); DateTime dT = this.myDateTimePicker1.Value.AddMonths(1); DateTime d2 = new DateTime(dT.Year, dT.Month, 1); int days = ((TimeSpan)(d2 - d1)).Days; DateTime beginDT = new DateTime(this.myDateTimePicker1.Value.Year, this.myDateTimePicker1.Value.Month, 1, 00, 00, 00); DateTime endDT = new DateTime(this.myDateTimePicker1.Value.Year, this.myDateTimePicker1.Value.Month, days, 23, 59, 59); IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); dataAccess.Open(); DataTable dtData = dataAccess.GetTable(string.Format("exec 报关制造通知单料件月份统计 '{0}','{1}','{2}'", beginDT, endDT, ConfigurationManager.AppSettings["defaultManualCode"].ToString())); dataAccess.Close(); this.myDataGridView1.DataSource = dtData; } catch (Exception ex) { SysMessage.ErrorMsg(ex.Message); } finally { this.btnQuery.Enabled = true; } }
{/** 啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊 * public static DbDataReader GetDefaultLineRoadDesignDR() * { * string sql = "select * from LineRoadDesignDetail a,LineRoadDesign b where a.LineRoadDesignID=b.LineRoadDesignID and b.IsDefault=1"; * var lrReader = DataAccessFactory.CreateDataAccess(DBConfigure.LJJSConfigureDb, DBConfigure.configConStr); * return lrReader.ExecuteReader(sql); * }**/ public static DbDataReader GetDefaultLineRoadDesignDR(string myLineRoadDesignName) { string sql = "select * from LineRoadDesignDetail a,LineRoadDesign b where a.LineRoadDesignID=b.LineRoadDesignID and b.LineRoadDesignName='" + myLineRoadDesignName + "'"; var lrReader = DataAccessFactory.CreateDataAccess(DBConfigure.LJJSConfigureDb, DBConfigure.configConStr); return(lrReader.ExecuteReader(sql)); }
/// <summary> /// 检查用户名的合法性 /// </summary> /// <param name="model">用户信息模型</param> /// <param name="strMessage">数据不合法时的提示信息</param> /// <returns>返回检查结果,TRUE或FALSE</returns> public bool checkUserInfo(UserInfoModel model, ref string strMessage) { bool bSuccess = false; try { IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Uniquegrade); dataAccess.Open();//,[权限1],[权限2],[权限3],[权限4],[值] string strSQL = string.Format("SELECT [登录名],[密码] FROM [权限表] where [登录名]='{0}' and [密码]='{1}'", model.UserName, model.UserPwd); DataTable dtUserInfo = dataAccess.GetTable(strSQL, null); dataAccess.Close(); if (dtUserInfo.Rows.Count > 0) { SystemGlobal.SystemGlobal_UserInfo = model; bSuccess = true; } else { strMessage = "用户账号或用户密码错误!"; bSuccess = false; } } catch (Exception ex) { strMessage = ex.Message; bSuccess = false; } return(bSuccess); }
public DbDataReader GetKeDuChiDesignByDB(string sqlCondition) { string sql = "select * from " + tableName + " " + sqlCondition; var drReader = DataAccessFactory.CreateDataAccess(DBConfigure.LJJSConfigureDb, DBConfigure.configConStr); return(drReader.ExecuteReader(sql)); }
private void FormMaterialsOutQueryList_CheckQueryList_Load(object sender, EventArgs e) { string strSQL = string.Empty; if (InOutvalue == 1) { strSQL = string.Format("报关进口料件数量转换统计 @id={0},@电子帐册号='{1}',@类别={2}", InId, ManualCode, passvalue); } else { strSQL = string.Format("报关出口料件数量转换统计 @id={0},@电子帐册号='{1}',@类别={2}", InId, ManualCode, passvalue); } IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); dataAccess.Open(); DataTable dtData = dataAccess.GetTable(strSQL, null); dataAccess.Close(); DataTableTools.AddEmptyRow(dtData); this.myDataGridView1.DataSource = dtData; foreach (DataGridViewTextBoxColumn textBoxColumn in this.myDataGridView1.Columns) { textBoxColumn.ContextMenuStrip = this.myContextMenuStripCell1; } }
//important public static DataTable SuiZuan_GetItemWorkDataTable(string fromTableName) { DrawPointContainer.fromtablename = fromTableName; //将 "2500-2600" 变为"2500"与"2600" 两个字符串 string[] strDepthArr = Regex.Split(FrameDesign.JdStrLst[0], DrawCommonData.jdSplitter.ToString()); double minDepth = double.Parse(strDepthArr[0]); //这是深度的小值 double maxDepth = double.Parse(strDepthArr[1]); //这是深度的大值 //string sqlstr = String.Format("select distinct * from {0} where jh = '{1}' and depth >={2} and depth<={3}", fromTableName, FrameDesign.JH, minDepth.ToString(), maxDepth.ToString()); string sqlstr = String.Format("select distinct * from {0} where jh = '{1}' order by depth asc", fromTableName, FrameDesign.JH); // string sqlstr = String.Format("select distinct * from {0} where jh = '{1}' and depth >={2} and depth<={3} order by depth asc", fromTableName, FrameDesign.JH, minDepth.ToString(), maxDepth.ToString()); DataTable dt = DataAccessFactory.CreateDataAccess(DBConfigure.LJJSDrawDb, DBConfigure.drawConStr).GetTable(sqlstr); return(dt); // ItemDAL.remove_redundant_depth_rows(dt); /** * bool res = check_if_has_data_after(fromTableName); //看在这个深度后面还有没有数据 * if (res == true) * { //随后有数据,接着随钻 * return dt; * } * else * { //随后没有数据,停止随钻 * DrawPointContainer.szf.Stop_Suizuan(); * return dt; * }**/ }
public override void tool1_Delete_Click(object sender, EventArgs e) { //base.tool1_Delete_Click(sender, e); try { if (this.myDataGridViewHead.CurrentRow == null) { return; } if (SysMessage.YesNoMsg(string.Format("真的要删除料件型号【{0}】,料件名称【{1}】吗?", this.myDataGridViewHead.CurrentRow.Cells["料件型号"].Value, this.myDataGridViewHead.CurrentRow.Cells["料件名称"].Value)) == System.Windows.Forms.DialogResult.No) { return; } string strSQL = string.Format("delete 料件资料表 where 料件id={0}", this.myDataGridViewHead.CurrentRow.Cells["料件id"].Value); IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); dataAccess.Open(); dataAccess.ExecuteNonQuery(strSQL, null); dataAccess.Close(); string strSuccess = string.Format("{0} 料件型号【{1}】,料件名称【{2}】成功!", tool1_Delete.Text, this.myDataGridViewHead.CurrentRow.Cells["料件型号"].Value, this.myDataGridViewHead.CurrentRow.Cells["料件名称"].Value); this.myDataGridViewHead.Rows.Remove(this.myDataGridViewHead.CurrentRow); setTool1Enabled(); SysMessage.InformationMsg(strSuccess); } catch (Exception ex) { string strError = string.Format("{0} 出现错误:错误信息:{1}", tool1_Delete.Text, ex.Message); SysMessage.ErrorMsg(strError); } }
/// <summary> /// 加载表头数据 /// </summary> private void LoadDataSourceHead() { try { IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); dataAccess.Open(); string strSQL = string.Format("select * FROM 归并后料件清单 where 电子帐册号={0} ORDER BY 序号", StringTools.SqlQ(gstrManualNo)); DataTable dtHead = dataAccess.GetTable(strSQL, null); dataAccess.Close(); bTriggerGridViewHead_SelectionChanged = false; DataTableTools.AddEmptyRow(dtHead); this.myDataGridViewHead.DataSource = dtHead; bTriggerGridViewHead_SelectionChanged = true; //if (this.dataGridViewHead.RowCount > 0) //{ // this.dataGridViewHead.CurrentCell = this.dataGridViewHead.Rows[0].Cells["电子帐册号"]; // this.dataGridViewHead.Rows[0].Selected = true; //} this.myDataGridViewHead_SelectionChanged(null, null); } catch (Exception ex) { SysMessage.ErrorMsg(string.Format("加载数据出错LoadDataSourceHead,错误信息如下:{0}{1}", Environment.NewLine, ex.Message)); } }
private void LoadDataSource() { IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); dataAccess.Open(); dtType = dataAccess.GetTable("select * from 产品类别表", null); dataAccess.Close(); this.treeView1.Nodes.Clear(); this.treeView1.Nodes.Add("0", "报关类别"); DataRow[] mainRow = dtType.Select("产品类别 is null"); foreach (DataRow row in mainRow) { TreeNode node = new TreeNode(); node.Name = row["产品类别ID"].ToString(); node.Text = row["产品类别描述"].ToString(); //this.treeView1.Nodes[0].Nodes.Add(row["产品类别ID"].ToString(),row["产品类别描述"].ToString()); DataRow[] subRow = dtType.Select(string.Format("产品类别={0}", row["产品类别ID"])); foreach (DataRow row2 in subRow) { node.Nodes.Add(row2["产品类别ID"].ToString(), row2["产品类别描述"].ToString()); } this.treeView1.Nodes[0].Nodes.Add(node); } this.treeView1.Nodes[0].Expand(); }
public override void tool1_Delete_Click(object sender, EventArgs e) { try { if (this.myDataGridViewHead.CurrentRow == null) { return; } int iOrderID = Convert.ToInt32(this.myDataGridViewHead.CurrentRow.Cells["报关产品表id"].Value); if (SysMessage.OKCancelMsg(string.Format("真的要删除 报关产品表id {0} 吗?", this.myDataGridViewHead.CurrentRow.Cells["报关产品表id"].Value)) == System.Windows.Forms.DialogResult.Cancel) { return; } IDataAccess data = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); data.Open(); string strSQL = string.Format(@"delete from 报关产品表 where 报关产品表.报关产品表id={0} delete from 报关产品组成明细表 where 报关产品组成明细表.报关产品表id={0}", this.myDataGridViewHead.CurrentRow.Cells["报关产品表id"].Value); data.ExecuteNonQuery(strSQL, null); data.Close(); string strSuccess = string.Format("{0}[{1}]成功!", tool1_Delete.Text, this.myDataGridViewHead.CurrentRow.Cells["报关产品表id"].Value); this.myDataGridViewHead.Rows.Remove(this.myDataGridViewHead.CurrentRow); setTool1Enabled(); SysMessage.InformationMsg(strSuccess); } catch (Exception ex) { string strError = string.Format("{0} 出现错误:错误信息:{1}", tool1_Delete.Text, ex.Message); SysMessage.ErrorMsg(strError); } }
protected override void zExecuteStep() { string command = DataUtils.ApplyStateVariablesToString(m_Step.Command, CurrentScope.DataScope, m_Step.TrimVariableValueWhitespace); using (IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(m_Step.ConnectionType, m_Step.ConnectionString)) { DataAccessResult result; if (m_Step.ResultMapping is ScalarResultMapping) { DataAccessResult <object> scalarResult = dataAccess.ExecuteScalar(m_Step.CommandType, command, paramBuilder => zCreateInputParameters(paramBuilder)); zReadScalarResult(scalarResult.Value); result = scalarResult; } else if (m_Step.ResultMapping is TableResultMapping) { result = dataAccess.ExecuteQueryReader(m_Step.CommandType, command, paramBuilder => zCreateInputParameters(paramBuilder), reader => zReadTableResult(reader)); } else { result = dataAccess.ExecuteNonQuery(m_Step.CommandType, command, paramBuilder => zCreateInputParameters(paramBuilder)); } zReadOutputParameters(result.OutputParameters); } zCompleteStep(StepResult.Success); }
//编号生成 private void btnCreateNo_Click(object sender, EventArgs e) { if (txt_显示型号.Text.Trim().Length == 0) { SysMessage.InformationMsg(string.Format("【{0}】不能为空!", lab_显示型号.Text)); txt_显示型号.Focus(); return; } string strSQL = string.Format(@"declare @No varchar(10) set @No={0} exec [料件台北编号生成] @No out select @No as no", StringTools.SqlQ(txt_显示型号.Text.Trim())); IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); dataAccess.Open(); DataTable dtManual = dataAccess.GetTable(strSQL.ToString(), null); dataAccess.Close(); if (txt_料件名.Text.Trim().Length == 0) { txt_料件名.Text = txt_显示型号.Text; rowHead["料件名"] = txt_料件名.Text; } txt_显示型号.Text = dtManual.Rows[0][0].ToString(); rowHead["显示型号"] = dtManual.Rows[0][0].ToString(); }
private void btnDelete_Click(object sender, EventArgs e) { DataGridViewRow dgv = null; int year = 0; int month = 0; if (this.myDataGridView1.CurrentRowNew != null) { if (this.myDataGridView1.Rows[this.myDataGridView1.CurrentRowNew.Index].Cells["年"].Value != DBNull.Value) { year = (int)this.myDataGridView1.Rows[this.myDataGridView1.CurrentRowNew.Index].Cells["年"].Value; month = (int)this.myDataGridView1.Rows[this.myDataGridView1.CurrentRowNew.Index].Cells["月"].Value; if (SysMessage.OKCancelMsg(string.Format("确定要删除【{0}年{1}月】的汇率吗?", year, month)) == DialogResult.OK) { IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Uniquegrade); dataAccess.Open(); dataAccess.ExecuteNonQuery(string.Format("delete exchangerate where iyear={0} and imonth={1}", year, month)); dataAccess.Close(); LoadDataSource(); } } else { return; } } else { return; } }
//复制 private void btnClone_Click(object sender, EventArgs e) { FormBaseDialogInput objForm = new FormBaseDialogInput(); objForm.strDefault = txt_料件型号.Text; objForm.strFormText = "料件资料克隆(请输入源料件型号:)"; if (objForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (objForm.strReturn.Trim().Length > 0) { IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); dataAccess.Open(); string strSQL = string.Format("SELECT * FROM 料件资料表 WHERE 料件型号 = {0}", StringTools.SqlQ(objForm.strReturn)); DataTable dtTemp = dataAccess.GetTable(strSQL.ToString(), null); dataAccess.Close(); if (dtTemp.Rows.Count == 0) { SysMessage.InformationMsg("指定的料件不存存!"); } else { // "料件id", "料件型号", "料件建档日期" 不做处理 foreach (DataColumn col in dtTemp.Columns) { if (col.ColumnName != "料件id" && col.ColumnName != "料件型号" && col.ColumnName != "料件建档日期") { rowHead[col.ColumnName] = dtTemp.Rows[0][col.ColumnName]; } } fillControl(rowHead); } } } }
//文本控件值变化时验证 private void txt_Validating(object sender, CancelEventArgs e) { myTextBox txtBox = (myTextBox)sender; if (txtBox.Text.Trim().Length == 0) { return; } string fieldName = txtBox.Name.Replace("txt_", ""); string strSQL = string.Empty; IDataAccess dataAccess = null; switch (fieldName) { case "料件型号": #region 料件型号 if (rowHead.RowState == DataRowState.Added || (rowHead.RowState == DataRowState.Modified && rowHead["料件型号", DataRowVersion.Original].ToString() != txtBox.Text)) { strSQL = string.Format("SELECT 料件id FROM 料件资料表 WHERE 料件型号 = {0}", StringTools.SqlQ(txtBox.Text)); dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); dataAccess.Open(); DataTable dtManual = dataAccess.GetTable(strSQL.ToString(), null); dataAccess.Close(); if (dtManual.Rows.Count > 0) { SysMessage.InformationMsg("此料件型号已存在,请重新输入!"); e.Cancel = true; txtBox.Focus(); } } break; #endregion } }
public override void tool1_Delete_Click(object sender, EventArgs e) { base.tool1_Delete_Click(sender, e); if (this.myDataGridViewHead.CurrentRow == null) { return; } string strText = string.Format("真的要删除出库单号 【{0}】 吗?", this.myDataGridViewHead.CurrentRow.Cells["出库单号"].Value); if (SysMessage.OKCancelMsg(strText) == System.Windows.Forms.DialogResult.Cancel) { return; } try { IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); dataAccess.Open(); string strSQL = string.Format("删除指定的进口料件出库资料 {0}", this.myDataGridViewHead.CurrentRow.Cells["料件出库表id"].Value); dataAccess.ExecuteNonQuery(strSQL, null); dataAccess.Close(); string strSuccess = string.Format("{0}[{1}]成功!", tool1_Delete.Text, this.myDataGridViewHead.CurrentRow.Cells["出库单号"].Value); this.myDataGridViewHead.Rows.Remove(this.myDataGridViewHead.CurrentRow); setTool1Enabled(); SysMessage.InformationMsg(strSuccess); } catch (Exception ex) { string strError = string.Format("{0} 出现错误:错误信息:{1}", tool1_Delete.Text, ex.Message); SysMessage.ErrorMsg(strError); } }
/// <summary> /// 加载数据 /// </summary> public void LoadDataSource() { string strSQL = string.Format("SELECT * FROM 料件资料表 WHERE 料件id = {0}", giOrderID); IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); dataAccess.Open(); dtHead = dataAccess.GetTable(strSQL, null); dataAccess.Close(); bcbox_SelectedIndexChanged = false; bdatetime_料件建档日期_ValueChanged = false; bchk_计算库存_CheckedChanged = false; if (dtHead.Rows.Count > 0) { rowHead = dtHead.Rows[0]; fillControl(rowHead); } else { rowHead = dtHead.NewRow(); dtHead.Rows.Add(rowHead); datetime_料件建档日期.Value = DateTime.Now; datetime_料件建档日期.Checked = false; rowHead["计算库存"] = 1; fillControl(rowHead); } bcbox_SelectedIndexChanged = true; bdatetime_料件建档日期_ValueChanged = true; bchk_计算库存_CheckedChanged = true; }
public static DbDataReader GetSelectWellDataReader() { string sqltxt = "select distinct jh ,JB,HTDW from " + MyTableManage.DrawingJHTbName; var wellReader = DataAccessFactory.CreateDataAccess(DBConfigure.LJJSDrawDb, DBConfigure.drawConStr); return(wellReader.ExecuteReader(sqltxt)); }
/// <summary> /// 加载订单内容数据 /// </summary> private void LoadDataSourceDetails() { try { int iOrderID = 0; string strBooksNo = string.Empty; if (this.myDataGridViewHead.CurrentRowNew != null) { if (this.myDataGridViewHead.Rows[this.myDataGridViewHead.CurrentRowNew.Index].Cells["料件出库表id"].Value != DBNull.Value) { iOrderID = (int)this.myDataGridViewHead.Rows[this.myDataGridViewHead.CurrentRowNew.Index].Cells["料件出库表id"].Value; strBooksNo = this.myDataGridViewHead.CurrentRowNew.Cells["电子帐册号"].Value.ToString(); } } IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); dataAccess.Open(); //string strSQL = string.Format("select * from 报关预先订单明细表 where 订单id={0}", iOrderID); string strSQL = string.Format("exec 进口料件出库修改查询 {0},{1}", iOrderID, StringTools.SqlQ(strBooksNo)); DataTable dtDetails = dataAccess.GetTable(strSQL, null); dataAccess.Close(); DataTableTools.AddEmptyRow(dtDetails); this.myDataGridViewDetails.DataSource = dtDetails; } catch (Exception ex) { SysMessage.ErrorMsg(string.Format("加载【出库单明细】出错,错误信息如下:{0}{1}", Environment.NewLine, ex.Message)); } }
public static DbDataReader GetHeaderTableDataReader() { string sqltxt = "select distinct * from " + HeaderTableDataManage.DrawingHeaderTbName + @" where jh = '" + FrameDesign.JH + @"'"; var htReader = DataAccessFactory.CreateDataAccess(DBConfigure.LJJSDrawDb, DBConfigure.drawConStr); return(htReader.ExecuteReader(sqltxt)); }
/// <summary> /// 加载订单内容数据 /// </summary> private void LoadDataSourceDetails() { try { int iOrderID = 0; string strBooksNo = string.Empty; if (this.myDataGridViewHead.CurrentRowNew != null) { if (this.myDataGridViewHead.Rows[this.myDataGridViewHead.CurrentRowNew.Index].Cells["Pid"].Value != DBNull.Value) { iOrderID = (int)this.myDataGridViewHead.Rows[this.myDataGridViewHead.CurrentRowNew.Index].Cells["Pid"].Value; } } IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Uniquegrade); dataAccess.Open(); string strSQL = string.Format("exec 出口装箱单录入查询 {0}", iOrderID); DataTable dtDetails = dataAccess.GetTable(strSQL, null); dataAccess.Close(); DataTableTools.AddEmptyRow(dtDetails); this.myDataGridViewDetails.DataSource = dtDetails; } catch (Exception ex) { SysMessage.ErrorMsg(string.Format("加载【PACKING LIST】出错,错误信息如下:{0}{1}", Environment.NewLine, ex.Message)); } }
/// <summary> /// 加载订单内容数据 /// </summary> private void LoadDataSourceDetails() { try { int iManualID = 0; string strBooksNo = string.Empty; if (this.myDataGridViewHead.CurrentRowNew != null) { iManualID = (int)this.myDataGridViewHead.Rows[this.myDataGridViewHead.CurrentRowNew.Index].Cells["手册id"].Value; } IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Uniquegrade); dataAccess.Open(); string strSQL = string.Format("exec 出口成品表录入查询 {0}" + Environment.NewLine, iManualID); strSQL += string.Format("exec 进口料件表录入查询 {0}", iManualID); DataSet ds = dataAccess.GetDataSet(strSQL, null); dataAccess.Close(); DataTable dtDetails = ds.Tables[0]; DataTable dtDetails2 = ds.Tables[1]; DataTableTools.AddEmptyRow(dtDetails); DataTableTools.AddEmptyRow(dtDetails2); this.myDataGridViewDetails.DataSource = dtDetails; this.myDataGridViewDetailsInput.DataSource = dtDetails2; } catch (Exception ex) { SysMessage.ErrorMsg(string.Format("加载【InvoiceOut】出错,错误信息如下:{0}{1}", Environment.NewLine, ex.Message)); } }
public override void tool1_Delete_Click(object sender, EventArgs e) { try { if (this.myDataGridViewHead.CurrentRow == null) { return; } int iOrderID = Convert.ToInt32(this.myDataGridViewHead.CurrentRow.Cells["手册id"].Value); if (SysMessage.OKCancelMsg(string.Format("真的要删除手册编号【{0}】吗?", this.myDataGridViewHead.CurrentRow.Cells["手册编号"].Value)) == System.Windows.Forms.DialogResult.Cancel) { return; } IDataAccess data = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); data.Open(); DataTable dtList = data.GetTable(string.Format("删除指定的手册资料", iOrderID), null); data.Close(); string strSuccess = string.Format("{0}[{1}]成功!", tool1_Delete.Text, this.myDataGridViewHead.CurrentRow.Cells["手册编号"].Value); this.myDataGridViewHead.Rows.Remove(this.myDataGridViewHead.CurrentRow); setTool1Enabled(); SysMessage.InformationMsg(strSuccess); } catch (Exception ex) { string strError = string.Format("{0} 出现错误:错误信息:{1}", tool1_Delete.Text, ex.Message); SysMessage.ErrorMsg(strError); } }
public override void tool1_Delete_Click(object sender, EventArgs e) { base.tool1_Delete_Click(sender, e); if (this.myDataGridViewHead.CurrentRow == null) { return; } string strText = string.Format("真的要删除订单 【{0}】 吗?", this.myDataGridViewHead.CurrentRow.Cells["订单号码"].Value); if (SysMessage.OKCancelMsg(strText) == System.Windows.Forms.DialogResult.Cancel) { return; } try { StringBuilder strBuilder = new StringBuilder(); strBuilder.AppendLine(string.Format("delete from 装箱单明细表 where 订单id={0}", this.myDataGridViewHead.CurrentRow.Cells["订单id"].Value)); strBuilder.AppendLine(string.Format("delete from 装箱单表 where 订单id={0}", this.myDataGridViewHead.CurrentRow.Cells["订单id"].Value)); IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Uniquegrade); dataAccess.Open(); dataAccess.ExecuteNonQuery(strBuilder.ToString(), null); dataAccess.Close(); string strSuccess = string.Format("{0}[{1}]成功!", tool1_Delete.Text, this.myDataGridViewHead.CurrentRow.Cells["订单号码"].Value); this.myDataGridViewHead.Rows.Remove(this.myDataGridViewHead.CurrentRow); setTool1Enabled(); SysMessage.InformationMsg(strSuccess); } catch (Exception ex) { string strError = string.Format("{0} 出现错误:错误信息:{1}", tool1_Delete.Text, ex.Message); SysMessage.ErrorMsg(strError); } }
public void LogSign(ref LoginUserWcf loginUser, string Msg, ref Boolean Done) { //检查此人登录 DateTime lvtimeStart = DateTime.Now.AddHours(-8); string lvSql = "select count(*) from Mem_User_LogIn with(nolock) where FUserID=" + loginUser.Uid.ToString() + @" and FDateLogIn>@FDateLogIn"; IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(); List <IDbDataParameter> lvParams = new List <IDbDataParameter>(); object lvo = dataAccess.ExecuteScalar(lvSql, lvParams); if ((lvo != null) && (lvo != DBNull.Value)) { if (Convert.ToInt32(lvo) <= 0) { return; } } //最近登陆过的。那就把日志写到文件里。 //提供方法执行的上下文环境 OperationContext context = OperationContext.Current; //获取传进的消息属性 MessageProperties properties = context.IncomingMessageProperties; //获取消息发送的远程终结点IP和端口 RemoteEndpointMessageProperty endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty; string ip = string.Format("From {0}:{1}", endpoint.Address, endpoint.Port); log4net.ILog logsys = log4net.LogManager.GetLogger(LogName); logsys.Info(ip + " " + loginUser.LogID + ":" + loginUser.FirstName.Trim() + Environment.NewLine + Msg); Done = true; }
private void btnDelete_Click(object sender, EventArgs e) { if (this.treeView1.SelectedNode == null || this.treeView1.SelectedNode.Name == "0") { SysMessage.InformationMsg("请选择产品类别!"); return; } if (this.treeView1.SelectedNode.Nodes.Count > 0) { SysMessage.InformationMsg("此产品包含子类产品,不能删除,可先删除子类产品再删除!"); return; } if (SysMessage.OKCancelMsg(string.Format("确定要删除产品类别【{0}】吗?", this.treeView1.SelectedNode.Text)) == System.Windows.Forms.DialogResult.Cancel) { return; } string strSQL = string.Format("DELETE [产品类别表] WHERE 产品类别={0} DELETE [产品类别表] WHERE 产品类别ID={0}", this.treeView1.SelectedNode.Name); IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(DataAccessEnum.DataAccessName.DataAccessName_Manufacture); dataAccess.Open(); dataAccess.ExecuteNonQuery(strSQL, null); dataAccess.Close(); bModify = true; LoadDataSource(); }
public static DbDataReader GetAllColorCode() { string sqltxt = "select * from " + MyTableManage.ColorCodeTable; IDataAccess data = DataAccessFactory.CreateDataAccess(DBConfigure.LJJSConfigureDb, DBConfigure.configConStr); DbDataReader symbolCodeReader = data.ExecuteReader(sqltxt); return(symbolCodeReader); }
public static bool LogPermmision(ref LoginUserWcf loginUser) { bool lvRet = false; string ConnectionStringLocalTransaction = ConfigurationManager.ConnectionStrings["SQLConnectionString"].ConnectionString; IDataAccess dataAccess = DataAccessFactory.CreateDataAccess(ConnectionStringLocalTransaction); lvRet = LogPermmision(dataAccess, ref loginUser); return(lvRet); }