private void SetFeedbackInfo() //设置反馈信息 { var feedbackInfo = DBHelper.GetTable("查询反馈信息", "tb_CustomerSer_Feedback", "*", "Feedback_id = '" + FeedbackId + "'", "", ""); if (feedbackInfo != null && feedbackInfo.DefaultView.Count != 0) { CustId = feedbackInfo.DefaultView[0]["corp_id"].ToString(); ContId = feedbackInfo.DefaultView[0]["Feedback_by"].ToString(); txt_cb_title.Caption = feedbackInfo.DefaultView[0]["title"].ToString(); rtx_cb_record.Text = feedbackInfo.DefaultView[0]["record"].ToString(); HandleId = feedbackInfo.DefaultView[0]["handle_name"].ToString(); txt_cb_handle_org.Caption = CommonCtrl.IsNullToString(feedbackInfo.DefaultView[0]["handle_org"]); SetHandleInfo(); } }
//上传到宇通接口的性别转化 联系人时 ,性别传1(男)和2(女) private string UpSex(object sexvalue) { if (CommonCtrl.IsNullToString(sexvalue) == "1") { return("1"); } if (sexvalue.ToString() == "0") { return("2"); } else { return("1"); } }
//上传到宇通接口的性别转化 男为1 女为2 private string UpSex() { if (CommonCtrl.IsNullToString(this.cbosex.Text.ToString()) == "") { return("100000000"); } if (this.cbosex.Text.ToString() == "女") { return("100000001"); } else { return("100000000"); } }
void SelectedSupper() { if (dgvSupper.CurrentRow == null) { return; } supperID = CommonCtrl.IsNullToString(dgvSupper.CurrentRow.Cells["colSupperID"].Value); supperCode = CommonCtrl.IsNullToString(dgvSupper.CurrentRow.Cells[colSupperCode.Name].Value); supperName = CommonCtrl.IsNullToString(dgvSupper.CurrentRow.Cells[colSupperName.Name].Value); if (supperID.Length > 0) { this.DialogResult = DialogResult.OK; this.Close(); } }
private void dgvRData_CellClick(object sender, DataGridViewCellEventArgs e) { int rowindex = e.RowIndex; if (rowindex >= 0) { if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvRData.Rows[rowindex].Cells["return_id"].Value))) { return; } string strDId = this.dgvRData.Rows[rowindex].Cells["return_id"].Value.ToString(); DataTable dt = DBHelper.GetTable("宇通旧件返厂单导入详细信息列表", "tb_maintain_oldpart_recycle_material_detail", "*", "maintain_id='" + strDId + "'", "", "order by parts_id desc"); this.dgvRDetailData.DataSource = dt.Rows.Count > 0 ? dt : null; } }
/// <summary> /// 获取该供应商下所关联的所有联系人信息 /// </summary> /// <param name="suppId"></param> /// <returns></returns> private void GetAllContacts(string suppId) { string conId = string.Empty; DataTable dt_base_contacts = DBHelper.GetTable("查询关联的联系人ID集合", "tr_base_contacts", "*", " relation_object_id='" + suppId + "'", "", ""); if (dt_base_contacts != null && dt_base_contacts.Rows.Count > 0) { isdefault defaultModel = new isdefault(); List <isdefault> list_default = new List <isdefault>(); foreach (DataRow dr in dt_base_contacts.Rows) { conId += "'" + dr["cont_id"] + "',"; defaultModel = new isdefault(); defaultModel.cont_id = dr["cont_id"].ToString(); defaultModel.is_default = dr["is_default"] == null || dr["is_default"].ToString() == "" ? "0" : dr["is_default"].ToString(); list_default.Add(defaultModel); } conId = conId.Trim(','); string TableName = string.Format(@"(select dic_name as con_post_name,tb_contacts.* from tb_contacts left join sys_dictionaries on tb_contacts.cont_post=sys_dictionaries.dic_id) as tb_contacts"); DataTable dt_contacts = DBHelper.GetTable("查询关联的联系人信息", TableName, string.Format("*,{0} phone,{1} tel ", EncryptByDB.GetDesFieldValue("cont_phone"), EncryptByDB.GetDesFieldValue("cont_tel")), " cont_id in (" + conId + ")", "", ""); foreach (DataRow dr in dt_contacts.Rows) { DataGridViewRow dgvr = gvUserInfoList.Rows[gvUserInfoList.Rows.Add()]; dgvr.Cells["colcont_id"].Value = dr["cont_id"]; dgvr.Cells["colcont_name"].Value = dr["cont_name"]; dgvr.Cells["colcont_post"].Value = dr["con_post_name"]; dgvr.Cells["colcont_phone"].Value = dr["phone"]; dgvr.Cells["colcont_tel"].Value = dr["tel"]; dgvr.Cells["colremark"].Value = dr["remark"]; dgvr.Cells["colcont_email"].Value = dr["cont_email"]; if (list_default.Count > 0) { dgvr.Cells["colis_default"].Value = list_default.Where(p => p.cont_id == dr["cont_id"].ToString()).First().is_default; } string createTime = CommonCtrl.IsNullToString(dr["cont_birthday"]); if (createTime.Length > 0) { dgvr.Cells["colcont_birthday"].Value = DateTime.MinValue.AddTicks(Convert.ToInt64(createTime)).ToLocalTime(); } } } }
private void SaveProjectData(List <SQLObj> listSql, string partID) { foreach (DataGridViewRow dgvr in dgvproject.Rows) { string strPname = CommonCtrl.IsNullToString(dgvr.Cells["project_num"].Value); if (strPname.Length > 0) { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary <string, ParamObj> dicParam = new Dictionary <string, ParamObj>(); dicParam.Add("repair_package_set_id", new ParamObj("repair_package_set_id", partID, SysDbType.VarChar, 40)); dicParam.Add("project_num", new ParamObj("project_num", dgvr.Cells["project_num"].Value, SysDbType.VarChar, 40)); dicParam.Add("project_name", new ParamObj("project_name", dgvr.Cells["project_name"].Value, SysDbType.VarChar, 40)); dicParam.Add("repair_type", new ParamObj("repair_type", dgvr.Cells["repair_type"].Value, SysDbType.VarChar, 40)); dicParam.Add("whours_type", new ParamObj("whours_type", dgvr.Cells["whours_type"].Value, SysDbType.VarChar, 40)); dicParam.Add("whours_counts", new ParamObj("whours_counts", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["whours_counts"].Value)) ? dgvr.Cells["whours_counts"].Value : null, SysDbType.Int)); dicParam.Add("whours_price", new ParamObj("whours_price", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["whours_price"].Value)) ? dgvr.Cells["whours_price"].Value : null, SysDbType.Decimal, 15)); dicParam.Add("tax_amount", new ParamObj("tax_amount", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["tax_amount"].Value)) ? dgvr.Cells["tax_amount"].Value : null, SysDbType.Decimal, 15)); dicParam.Add("remark", new ParamObj("remark", dgvr.Cells["remark"].Value, SysDbType.VarChar, 200)); dicParam.Add("enable_flag", new ParamObj("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString(), SysDbType.VarChar, 1)); string strPID = CommonCtrl.IsNullToString(dgvr.Cells["repair_package_set_project_id"].Value); if (strPID.Length == 0) { opName = "新增维修套餐设置项目"; strPID = Guid.NewGuid().ToString(); dicParam.Add("repair_package_set_project_id", new ParamObj("repair_package_set_project_id", strPID, SysDbType.VarChar, 40)); dicParam.Add("create_by", new ParamObj("create_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//创建人id(制单人) dicParam.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); obj.sqlString = @"insert into sys_b_set_repair_package_set_project (repair_package_set_id,project_num,project_name ,repair_type,whours_type,whours_counts,whours_price,tax_amount,remark,repair_package_set_project_id,create_by,create_time,enable_flag) values (@repair_package_set_id,@project_num,@project_name ,@repair_type,@whours_type,@whours_counts,@whours_price,@tax_amount,@remark,@repair_package_set_project_id,@create_by,@create_time,@enable_flag);"; } else { dicParam.Add("repair_package_set_project_id", new ParamObj("repair_package_set_project_id", dgvr.Cells["repair_package_set_project_id"].Value, SysDbType.VarChar, 40)); opName = "更新维修套餐设置项目"; dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //修改人Id dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); //修改时间 obj.sqlString = @"update sys_b_set_repair_package_set_project set repair_package_set_id=@repair_package_set_id,project_num=@project_num,project_name=@project_name ,repair_type=@repair_type,whours_type=@whours_type,whours_counts=@whours_counts,whours_price=@whours_price,tax_amount=@tax_amount,remark=@remark ,update_by=@update_by,update_time=@update_time,enable_flag=@enable_flag where repair_package_set_project_id=@repair_package_set_project_id"; } obj.Param = dicParam; listSql.Add(obj); } } }
protected override void BindData() { if (custCode.Length == 0) { return; } dgvData.RowCount = 0; DataTable dt;//数据 StringBuilder sbWhere = new StringBuilder(); sbWhere.AppendFormat("cust_id='{0}'", custCode); sbWhere.AppendFormat(" and wait_money>0"); sbWhere.AppendFormat(" and isnull(is_occupy_finance,0)='{0}'", (int)DataSources.EnumImportStaus.OPEN); string orderNum = txtOrderNum.Caption.Trim();//单据编号 if (orderNum.Length > 0) { sbWhere.AppendFormat(" and settlement_no like '%{0}%'", orderNum); } string finance_voucher_no = txtCheckNumber.Caption.Trim();//财务凭证号 if (finance_voucher_no.Length > 0) { sbWhere.AppendFormat(" and finance_voucher_no like '%{0}%'", finance_voucher_no); } dt = DBHelper.GetTable("", "v_tb_maintain_three_guaranty_settlement_yt_receivable", "*", sbWhere.ToString(), "", ""); if (dt == null || dt.Rows.Count == 0) { return; } foreach (DataRow dr in dt.Rows) { DataGridViewRow dgvr = dgvData.Rows[dgvData.Rows.Add()]; dgvr.Cells["colID"].Value = dr["st_id"]; //ID dgvr.Cells["colBillsName"].Value = "三包结算单"; //单据名称 //dgvr.Cells["colBillsType"].Value = dr["price_type"];//单据类型 dgvr.Cells["colBillsCode"].Value = dr["settlement_no"]; //单据编码 dgvr.Cells["colTotalMoney"].Value = dr["sum_cost"]; //总金额 dgvr.Cells["colBalanceMoney"].Value = dr["money"]; //已结算 dgvr.Cells["colWaitMoney"].Value = dr["wait_money"]; //未结算 string date = CommonCtrl.IsNullToString(dr["clearing_time"]); if (date.Length > 0) { dgvr.Cells["colReceivablesDate"].Value = Common.UtcLongToLocalDateTime(Int64.Parse(date));//收款日期 } //dgvr.Cells["colReceiptNO"].Value = dr["receipt_no"];//发票号 } }
private void tsmiDown_Click(object sender, EventArgs e) { if (dgvAttachment.CurrentRow == null) { return; } string path = CommonCtrl.IsNullToString(dgvAttachment.CurrentRow.Cells[colAttPath.Name].Value); if (File.Exists(path)) { } else { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.FileName = path; string extension = Path.GetExtension(path); saveFileDialog.Filter = "所有文件(*)|*"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { Stream stream = FileOperation.DownLoadFile(path); if (stream == null || !stream.CanRead) { return; } try { using (FileStream fileStream = new FileStream(saveFileDialog.FileName, FileMode.Create, FileAccess.Write, FileShare.None)) { const int bufferLength = 4096; byte[] myBuffer = new byte[bufferLength];//数据缓冲区 int count; while ((count = stream.Read(myBuffer, 0, bufferLength)) > 0) { fileStream.Write(myBuffer, 0, count); } fileStream.Close(); stream.Close(); } MessageBoxEx.Show("下载成功!"); } catch (Exception ex) { MessageBoxEx.Show("下载失败!"); } } } }
/// <summary> /// 页面控件绑定数据 /// </summary> /// <param name="dt">用户信息</param> private void BindControls(DataTable dt) { txtuser_code.Caption = dt.Rows[0]["user_code"].ToString(); txtuser_name.Caption = dt.Rows[0]["user_name"].ToString(); txtland_name.Caption = dt.Rows[0]["land_name"].ToString(); txtuser_phone.Caption = dt.Rows[0]["user_phone"].ToString(); txtuser_telephone.Caption = dt.Rows[0]["user_telephone"].ToString(); txtremark.Caption = dt.Rows[0]["remark"].ToString(); txcorg_name.Text = dt.Rows[0]["org_name"].ToString(); txcorg_name.Tag = dt.Rows[0]["org_id"].ToString(); txtuser_fax.Caption = dt.Rows[0]["user_fax"].ToString(); cbosex.SelectedValue = dt.Rows[0]["sex"].ToString(); cboidcard_type.SelectedValue = dt.Rows[0]["idcard_type"].ToString(); txtuser_email.Caption = dt.Rows[0]["user_email"].ToString(); txtidcard_num.Caption = dt.Rows[0]["idcard_num"].ToString(); txtuser_address.Caption = dt.Rows[0]["user_address"].ToString(); cbonation.SelectedValue = dt.Rows[0]["nation"].ToString(); txtgraduate_institutions.Caption = dt.Rows[0]["graduate_institutions"].ToString(); txttechnical_expertise.Caption = dt.Rows[0]["technical_expertise"].ToString(); txtuser_height.Caption = dt.Rows[0]["user_height"].ToString(); txtnative_place.Caption = dt.Rows[0]["native_place"].ToString(); txtspecialty.Caption = dt.Rows[0]["specialty"].ToString(); dtpentry_date.Value = Common.UtcLongToLocalDateTime(Convert.ToInt64(dt.Rows[0]["entry_date"].ToString())); txtuser_weight.Caption = dt.Rows[0]["user_weight"].ToString(); txtregister_address.Caption = dt.Rows[0]["register_address"].ToString(); dtpgraduate_date.Value = Common.UtcLongToLocalDateTime(Convert.ToInt64(dt.Rows[0]["graduate_date"].ToString())); txtwage.Caption = dt.Rows[0]["wage"].ToString(); dtpbirthday.Value = Common.UtcLongToLocalDateTime(Convert.ToInt64(dt.Rows[0]["birthday"].ToString())); cboeducation.SelectedValue = dt.Rows[0]["education"].ToString(); cboposition.SelectedValue = dt.Rows[0]["position"].ToString(); txtpolitical_status.Caption = dt.Rows[0]["political_status"].ToString(); cbolevel.SelectedValue = dt.Rows[0]["level"].ToString(); cbojkzk.SelectedValue = dt.Rows[0]["health"].ToString();//健康状况 DataTable dt_pic = DBHelper.GetTable("查询用户图片", "attachment_info", "*", "relation_object_id='" + GlobalStaticObj.UserID + "' and att_name='用户图片' and att_type='图片'", "", ""); if (dt_pic != null && dt_pic.Rows.Count > 0) { string photoPath = CommonCtrl.IsNullToString(dt_pic.Rows[0]["att_path"]); photoID = CommonCtrl.IsNullToString(dt_pic.Rows[0]["att_id"]); picuser.BackgroundImage = FileOperation.DownLoadImage(photoPath); } }
/// <summary> /// 将数据表格中的数据转换为相对应的数据库表中的列数据 /// </summary> /// <param name="sender">数据表格</param> /// <param name="args">事件数据</param> /// <param name="dpName">数据列明</param> /// <param name="tableName">数据表明</param> /// <param name="pkColName">主键列名</param> /// <param name="valueColName">数据值列名</param> public static void DgvCellDataConvert2Table(DataGridView sender, DataGridViewCellFormattingEventArgs args, String dpName, String tableName, String pkColName, String valueColName) { var fieldNmae = sender.Columns[args.ColumnIndex].DataPropertyName; if (!fieldNmae.Equals(dpName)) { return; } if (String.IsNullOrEmpty(CommonCtrl.IsNullToString(args.Value))) { return; } var dbValue = DBHelper.GetSingleValue("获取数据表值", tableName, valueColName, pkColName + "='" + args.Value + "'", ""); args.Value = dbValue; }
/// <summary> /// 将数据表格中的数据(码表ID)转换为数据码表中的名称 /// </summary> /// <param name="sender">数据表格</param> /// <param name="args">事件数据</param> /// <param name="dpName">数据列明</param> public static void DgvCellDataConvert2DicData(DataGridView sender, DataGridViewCellFormattingEventArgs args, String dpName) { var fieldNmae = sender.Columns[args.ColumnIndex].DataPropertyName; if (!fieldNmae.Equals(dpName)) { return; } if (String.IsNullOrEmpty(CommonCtrl.IsNullToString(args.Value))) { return; } string msg; args.Value = GetDicName(args.Value.ToString(), out msg); }
private void dgvRDetailData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.Value == null) { return; } string fieldNmae = dgvRData.Columns[e.ColumnIndex].DataPropertyName; if (fieldNmae.Equals("process_mode")) { if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(e.Value))) { e.Value = GetDicName(e.Value.ToString()); } } }
public void BindData(string orderID) { BindData(); if (string.IsNullOrEmpty(orderID)) { return; } foreach (DataGridViewRow dgvr in dgvVerification.Rows) { if (CommonCtrl.IsNullToString(dgvr.Cells[colAccountVerificationID.Name].Value) == orderID) { dgvVerification.CurrentCell = dgvr.Cells[colOrderType.Name]; break; } } }
/// <summary> /// 选择当前行 /// </summary> void SelectedRow() { if (dgvParts.CurrentRow == null) { return; } PartsID = CommonCtrl.IsNullToString(dgvParts.CurrentRow.Cells[colPartsID.Name].Value); PartsCode = CommonCtrl.IsNullToString(dgvParts.CurrentRow.Cells[colSerPartsCode.Name].Value); CarPartsCode = CommonCtrl.IsNullToString(dgvParts.CurrentRow.Cells[colCarPartsCode.Name].Value); PartsName = CommonCtrl.IsNullToString(dgvParts.CurrentRow.Cells[colPartsName.Name].Value); ref_out_price = CommonCtrl.IsNullToString(dgvParts.CurrentRow.Cells["colref_out_price"].Value); if (SelectedRowEvent != null) { SelectedRowEvent(this); } }
/// <summary> /// 将数据表格中的数据转换为相对应的日期 /// </summary> /// <param name="sender">数据表格</param> /// <param name="args">事件数据</param> /// <param name="dpName">数据列明</param> public static void DgvCellDataConvert2Datetime(DataGridView sender, DataGridViewCellFormattingEventArgs args, String dpName) { var fieldNmae = sender.Columns[args.ColumnIndex].DataPropertyName; if (!fieldNmae.Equals(dpName)) { return; } if (String.IsNullOrEmpty(CommonCtrl.IsNullToString(args.Value))) { return; } var ticks = Convert.ToInt64(args.Value); args.Value = Common.UtcLongToLocalDateTime(ticks); }
/// <summary> /// 绑定数据后,定位到指定单击 /// </summary> /// <param name="orderID">指定单据ID</param> public void BindData(string orderID) { BindData(); if (string.IsNullOrEmpty(orderID)) { return; } foreach (DataGridViewRow dgvr in dgvBillReceivable.Rows) { if (CommonCtrl.IsNullToString(dgvr.Cells[colPayableSingleID.Name].Value) == orderID) { dgvBillReceivable.CurrentCell = dgvr.Cells[colOrderType.Name]; break; } } }
private void gvWorkList_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { strWhours_id = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["whours_id"].Value); strRepairType = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["repair_type"].Value); strProjectNum = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["project_num"].Value); strProjectName = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["project_name"].Value); strRemark = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["remark"].Value); strQuotaPrice = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["quota_price"].Value); strWhoursNum = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["whours_num_a"].Value); strWhoursType = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["whours_type"].Value); strWhoursChange = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells[drtxt_whours_change.Name].Value); this.DialogResult = DialogResult.OK; } }
private void gvWorkList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { strWhours_id = CommonCtrl.IsNullToString(gvWorkList.Rows[e.RowIndex].Cells["whours_id"].Value); strRepairType = CommonCtrl.IsNullToString(gvWorkList.Rows[e.RowIndex].Cells["repair_type"].Value); strProjectNum = CommonCtrl.IsNullToString(gvWorkList.Rows[e.RowIndex].Cells["project_num"].Value); strProjectName = CommonCtrl.IsNullToString(gvWorkList.Rows[e.RowIndex].Cells["project_name"].Value); strRemark = CommonCtrl.IsNullToString(gvWorkList.Rows[e.RowIndex].Cells["remark"].Value); strQuotaPrice = CommonCtrl.IsNullToString(gvWorkList.Rows[e.RowIndex].Cells["quota_price"].Value); strWhoursNum = CommonCtrl.IsNullToString(gvWorkList.Rows[e.RowIndex].Cells["whours_num_a"].Value); strWhoursType = CommonCtrl.IsNullToString(gvWorkList.Rows[e.RowIndex].Cells["whours_type"].Value); strWhoursChange = CommonCtrl.IsNullToString(gvWorkList.Rows[e.RowIndex].Cells[drtxt_whours_change.Name].Value); this.DialogResult = DialogResult.OK; } }
private void SaveMaterialsData(List <SQLObj> listSql, string partID) { foreach (DataGridViewRow dgvr in dgvMaterials.Rows) { string strPname = CommonCtrl.IsNullToString(dgvr.Cells["parts_name"].Value); if (strPname.Length > 0) { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary <string, ParamObj> dicParam = new Dictionary <string, ParamObj>(); dicParam.Add("repair_package_set_id", new ParamObj("repair_package_set_id", partID, SysDbType.VarChar, 40)); dicParam.Add("parts_code", new ParamObj("parts_code", dgvr.Cells["parts_code"].Value, SysDbType.VarChar, 40)); dicParam.Add("parts_name", new ParamObj("parts_name", dgvr.Cells["parts_name"].Value, SysDbType.VarChar, 40)); dicParam.Add("unit", new ParamObj("unit", dgvr.Cells["unit"].Value, SysDbType.VarChar, 20)); dicParam.Add("number", new ParamObj("number", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["number"].Value)) ? dgvr.Cells["number"].Value : null, SysDbType.Int)); dicParam.Add("original_price", new ParamObj("original_price", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["original_price"].Value)) ? dgvr.Cells["original_price"].Value : null, SysDbType.Decimal, 15)); dicParam.Add("preferential_price", new ParamObj("preferential_price", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["preferential_price"].Value)) ? dgvr.Cells["preferential_price"].Value : null, SysDbType.Decimal, 15)); dicParam.Add("remarks", new ParamObj("remarks", dgvr.Cells["Mremarks"].Value, SysDbType.VarChar, 200)); dicParam.Add("enable_flag", new ParamObj("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString(), SysDbType.VarChar, 1)); string strPID = CommonCtrl.IsNullToString(dgvr.Cells["repair_package_set_materials_id"].Value); if (strPID.Length == 0) { opName = "新增维修套餐设置用料"; strPID = Guid.NewGuid().ToString(); dicParam.Add("repair_package_set_materials_id", new ParamObj("repair_package_set_materials_id", strPID, SysDbType.VarChar, 40)); dicParam.Add("create_by", new ParamObj("create_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//创建人id(制单人) dicParam.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); obj.sqlString = @"insert into sys_b_set_repair_package_set_materials (repair_package_set_id,parts_code,parts_name,unit ,number,original_price,preferential_price,remarks,repair_package_set_materials_id,create_by,create_time,enable_flag) values (@repair_package_set_id,@parts_code,@parts_name,@unit,@number,@original_price,@preferential_price ,@remarks,@repair_package_set_materials_id,@create_by,@create_time,@enable_flag);"; } else { dicParam.Add("repair_package_set_materials_id", new ParamObj("repair_package_set_materials_id", dgvr.Cells["repair_package_set_materials_id"].Value, SysDbType.VarChar, 40)); dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //修改人Id dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); //修改时间 opName = "更新维修套餐设置用料"; obj.sqlString = @"update sys_b_set_repair_package_set_materials set repair_package_set_id=@repair_package_set_id,parts_code=@parts_code,parts_name=@parts_name,unit=@unit ,number=@number,original_price=@original_price,preferential_price=@preferential_price,remarks=@remarks,update_by=@update_by,update_time=@update_time,enable_flag=@enable_flag where repair_package_set_materials_id=@repair_package_set_materials_id"; } obj.Param = dicParam; listSql.Add(obj); } } }
/// <summary> 绑定数据 /// </summary> public void BindPageData(string where = "") { if (String.IsNullOrEmpty(where)) { //回访时间 var startTicks = dtpCBSTime.Value.Date.ToUniversalTime().Ticks; var endTicks = dtpCBETime.Value.Date.ToUniversalTime().Ticks; if (endTicks < startTicks) { MessageBoxEx.Show("回访结束时间小于回访开始时间"); dtpCBETime.Focus(); return; } where = "'1' = '1'"; if (!string.IsNullOrEmpty(txtCBTitle.Caption.Trim())) //回访标题 { where += string.Format(" and title like '%{0}%'", txtCBTitle.Caption.Trim()); } if (cboCBType.SelectedValue != null && !string.IsNullOrEmpty(cboCBType.SelectedValue.ToString())) //回访类型 { where += string.Format(" and Callback_type like '%{0}%'", cboCBType.SelectedValue); } if (cboCBType.SelectedValue != null && !string.IsNullOrEmpty(cboCBMode.SelectedValue.ToString())) //回访形式 { where += string.Format(" and Callback_mode like '%{0}%'", cboCBMode.SelectedValue); } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCustomerName.Tag))) //客户名称 { where += string.Format(" and Callback_corp like '%{0}%'", txtCustomerName.Tag); } //回访人 if (!string.IsNullOrEmpty(txtCBPerson.Text)) { where += string.Format(" and Callback_by like '%{0}%'", CommonCtrl.IsNullToString(txtCBPerson.Tag)); } where += " and create_time>=" + startTicks; where += " and create_time<" + endTicks; } int recordCount; var dt = DBHelper.GetTableByPage("分页查询客户回访记录", "tb_CustomerSer_Callback", "*", where, "", "status desc,Callback_time desc", pageQ.PageIndex, pageQ.PageSize, out recordCount); dgvQData.DataSource = dt; pageQ.RecordCount = recordCount; SetUCBaseFuncationVisible(); }
private void dgvMaterials_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[e.RowIndex].Cells["parts_code"].Value)) && !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[e.RowIndex].Cells["parts_name"].Value))) { if (e.ColumnIndex == 8 || e.ColumnIndex == 7) { ControlsConfig.SetCellsValue(dgvMaterials, e.RowIndex, "quantity,unit_price"); string strNum = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[e.RowIndex].Cells["quantity"].Value)) ? dgvMaterials.Rows[e.RowIndex].Cells["quantity"].Value.ToString() : "0"; string strUnitPrice = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[e.RowIndex].Cells["unit_price"].Value)) ? dgvMaterials.Rows[e.RowIndex].Cells["unit_price"].Value.ToString() : "0"; dgvMaterials.Rows[e.RowIndex].Cells["sum_money"].Value = Convert.ToString(Convert.ToDecimal(strNum = strNum == "" ? "0" : strNum) * Convert.ToDecimal(Convert.ToDecimal(strUnitPrice = strUnitPrice == "" ? "0" : strUnitPrice))); } } }
private void dgvMaterials_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.Value == null) { return; } string fieldNmae = dgvMaterials.Columns[e.ColumnIndex].DataPropertyName; if (fieldNmae.Equals("whether_imported")) { e.Value = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(e.Value)) ? e.Value.ToString() == "1" ? "是" : "否" : ""; } if (fieldNmae.Equals("vehicle_brand")) { e.Value = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(e.Value)) ? GetDicName(e.Value.ToString()) : ""; } }
private void SetContInfo() //设置被回访人信息 { txt_cb_Callback_by.Tag = ContId; var custInfo = DBHelper.GetTable("查询回访记录信息", "tb_CustomerSer_Callback", "*", "Callback_id = '" + CallBackId + "'", "", ""); if (custInfo != null && custInfo.DefaultView.Count != 0) { txt_cb_Callback_by.Tag = CommonCtrl.IsNullToString(custInfo.DefaultView[0]["Callback_by"]); txt_cb_Callback_by_org.Caption = CommonCtrl.IsNullToString(custInfo.DefaultView[0]["Callback_by_org"]); txt_cb_Callback_by_phone.Caption = CommonCtrl.IsNullToString(custInfo.DefaultView[0]["Callback_by_phone"]); txt_cb_Callback_by_duty.Caption = CommonCtrl.IsNullToString(custInfo.DefaultView[0]["Callback_by_duty"]); } var custInfo1 = DBHelper.GetTable("查询回访记录信息", "tb_contacts", "*", "cont_id = '" + txt_cb_Callback_by.Tag + "'", "", ""); txt_cb_Callback_by.Text = CommonCtrl.IsNullToString(custInfo1.DefaultView[0]["cont_name"]); }
/// <summary> /// 车牌号速查连带信息 /// </summary> /// <param name="dr"></param> void txtCarNO_DataBacked(DataRow dr) { try { txtCarType.Text = GetVmodel(CommonCtrl.IsNullToString(dr["v_model"])); txtCarType.Tag = CommonCtrl.IsNullToString(dr["v_model"]); txtCustomNO.Text = CommonCtrl.IsNullToString(dr["cust_code"]); txtCustomNO.Tag = CommonCtrl.IsNullToString(dr["cust_id"]); txtCustomName.Caption = CommonCtrl.IsNullToString(dr["cust_name"]); txtContact.Caption = CommonCtrl.IsNullToString(dr["cont_name"]); //txtContactPhone.Caption = CommonCtrl.IsNullToString(dr["cont_phone"]); } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
private void btnSubmit_Click(object sender, EventArgs e) { if (!IsCheck()) { return; } strWhours_id = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["whours_id"].Value); strRepairType = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["repair_type"].Value); strProjectNum = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["project_num"].Value); strProjectName = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["project_name"].Value); strRemark = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["remark"].Value); strQuotaPrice = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["quota_price"].Value); strWhoursNum = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["whours_num_a"].Value); strWhoursType = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells["whours_type"].Value); strWhoursChange = CommonCtrl.IsNullToString(gvWorkList.CurrentRow.Cells[drtxt_whours_change.Name].Value); this.DialogResult = DialogResult.OK; }
//选择行 private void SelectRow() { if (dgvContacts.CurrentRow == null) { return; } contID = CommonCtrl.IsNullToString(dgvContacts.CurrentRow.Cells["colContID"].Value); contName = CommonCtrl.IsNullToString(dgvContacts.CurrentRow.Cells["colContName"].Value); crmId = CommonCtrl.IsNullToString(dgvContacts.CurrentRow.Cells["col_cont_crm_guid"].Value); contDuty = CommonCtrl.IsNullToString(dgvContacts.CurrentRow.Cells["colContPost"].Value); contPhone = CommonCtrl.IsNullToString(dgvContacts.CurrentRow.Cells["colContPhone"].Value); contTel = CommonCtrl.IsNullToString(dgvContacts.CurrentRow.Cells["colContTel"].Value); if (contID.Length > 0) { this.DialogResult = DialogResult.OK; } }
/// <summary> /// 旧件收货单导入-根据前置单据绑定维修信息 /// </summary> public void BindSetmentData(string strOldId) { DataTable dt = DBHelper.GetTable("查询旧件收货单", "tb_maintain_oldpart_receiv_send", "*", " oldpart_id ='" + strOldId + "'", "", ""); if (dt == null || dt.Rows.Count == 0) { return; } DataRow dr = dt.Rows[0]; txtCustomNO.Text = CommonCtrl.IsNullToString(dr["customer_code"]); //客户编码 txtCustomName.Caption = CommonCtrl.IsNullToString(dr["customer_name"]); //客户名称 txtCustomNO.Tag = CommonCtrl.IsNullToString(dr["customer_id"]); //客户关联id txtContact.Caption = CommonCtrl.IsNullToString(dr["linkman"]); //联系人 txtContactPhone.Caption = CommonCtrl.IsNullToString(dr["link_man_mobile"]); //联系人手机 txtRemark.Caption = CommonCtrl.IsNullToString(dr["remarks"]); //备注 }
/// <summary> /// 将数据表格中的数据转换为相对应的数据库表中的列数据 /// </summary> /// <param name="sender">数据表格</param> /// <param name="args">事件数据</param> /// <param name="dpName">数据列明</param> /// <param name="tableName">数据表明</param> /// <param name="pkColName">主键列名</param> /// <param name="valueColName1">数据值列名1</param> /// <param name="valueColName2">数据值列名2</param> public static void DgvCellData2Connect(DataGridView sender, DataGridViewCellFormattingEventArgs args, String dpName, String tableName, String pkColName, String valueColName1, String valueColName2) { var fieldNmae = sender.Columns[args.ColumnIndex].DataPropertyName; if (!fieldNmae.Equals(dpName)) { return; } if (String.IsNullOrEmpty(CommonCtrl.IsNullToString(args.Value))) { return; } var dbValue1 = Convert.ToInt64(DBHelper.GetSingleValue("获取数据表值", tableName, valueColName1, pkColName + "='" + args.Value + "'", "")); var dbValue2 = Convert.ToInt64(DBHelper.GetSingleValue("获取数据表值", tableName, valueColName2, pkColName + "='" + args.Value + "'", "")); args.Value = Common.UtcLongToLocalDateTime(dbValue1) + " -- " + Common.UtcLongToLocalDateTime(dbValue2); }
private Boolean CheckValue() //必填字段非空验证 { if (String.IsNullOrEmpty(txt_cust_code.Text.Trim())) { MessageBoxEx.Show("客户编码不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); txt_cust_code.Focus(); return(false); } if (String.IsNullOrEmpty(txt_cb_Callback_by.Text.Trim())) { MessageBoxEx.Show("反馈人不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); txt_cb_title.Focus(); return(false); } if (String.IsNullOrEmpty(txt_cb_title.Caption.Trim())) { MessageBoxEx.Show("反馈标题不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); txt_cb_title.Focus(); return(false); } if (String.IsNullOrEmpty(CommonCtrl.IsNullToString(cbo_cb_Callback_mode.SelectedValue))) { MessageBoxEx.Show("反馈形式不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); cbo_cb_Callback_mode.Focus(); return(false); } if (String.IsNullOrEmpty(CommonCtrl.IsNullToString(cbo_cb_Callback_type.SelectedValue))) { MessageBoxEx.Show("反馈类型不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); cbo_cb_Callback_type.Focus(); return(false); } if (String.IsNullOrEmpty(txt_handle_name.Text.Trim())) { MessageBoxEx.Show("经办人不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); txt_handle_name.Focus(); return(false); } //if (String.IsNullOrEmpty(txt_cb_handle_org.Caption.Trim())) //{ // MessageBoxEx.Show("部门不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); // txt_cb_handle_org.Focus(); // return false; //} return(true); }