예제 #1
0
        /// <summary> 绑定车辆档案数据
        /// </summary>
        private void BindPageData(string where)
        {
            //select a.license_plate,a.vin,a.engine_num,a.v_model,a.v_color,a.v_brand,a.turner,b.cust_name,b.cust_code,a.remark,a.v_id,a.cust_id,d.cont_name,d.cont_phone
            //from tb_vehicle a left join tb_customer b on a.cust_id=b.cust_id left join tr_driver_vehicle c on a.v_id=c.v_id left join tb_contacts d on c.driver_id=d.cont_id
            //where c.isDefault='1'
            int recordCount;
            //string strFileds = @" top(20) a.license_plate,a.vin,a.engine_num,a.v_model,a.v_color,a.v_brand,a.turner,b.cust_name,b.cust_code,a.remark,a.v_id,a.cust_id,d.cont_name,d.cont_phone";
            //var dt = DBHelper.GetTableByPage("选择器车辆档案列表", "tb_vehicle a left join tb_customer b on a.cust_id=b.cust_id left join tr_driver_vehicle c on a.v_id=c.v_id and isDefault='1' left join tb_contacts d on c.driver_id=d.cont_id", strFileds, where, "", "order by a.create_time desc", pageQ.PageIndex, pageQ.PageSize, out recordCount);
            string strFileds = string.Format(" *,{0} phone", EncryptByDB.GetDesFieldValue("cont_phone"));
            var    dt        = DBHelper.GetTableByPage("选择器车辆档案列表", "v_vehicle", strFileds, where + AppendWhere, "", "order by create_time desc", pageQ.PageIndex, pageQ.PageSize, out recordCount);

            dgvVehicle.DataSource = dt;
            pageQ.RecordCount     = recordCount;
        }
예제 #2
0
        private void UCContactsView_Load(object sender, EventArgs e)
        {
            //SetBtnStatus(WindowStatus.View);
            DataTable dt = DBHelper.GetTable("联系人预览", "v_contacts", string.Format("*,{0} phone,{1} tel", EncryptByDB.GetDesFieldValue("cont_phone"), EncryptByDB.GetDesFieldValue("cont_tel")), string.Format(" cont_id='{0}'", contID), "", "");

            if (dt == null || dt.Rows.Count == 0)
            {
                lblContEmail.Text  = string.Empty;
                lblContName.Text   = string.Empty;
                lblContPhone.Text  = string.Empty;
                lblContPost.Text   = string.Empty;
                lblCreateBy.Text   = string.Empty;
                lblCreateTime.Text = string.Empty;
                lblNation.Text     = string.Empty;
                lblRemark.Text     = string.Empty;
                lblSex.Text        = string.Empty;
            }
            else
            {
                DataRow dr = dt.Rows[0];
                lblContEmail.Text = CommonCtrl.IsNullToString(dr["cont_email"]);
                lblContName.Text  = CommonCtrl.IsNullToString(dr["cont_name"]);
                lblContPhone.Text = CommonCtrl.IsNullToString(dr["phone"]);
                lblContTel.Text   = CommonCtrl.IsNullToString(dr["tel"]);
                lblContPost.Text  = CommonCtrl.IsNullToString(dr["cont_post_name"]);
                lblCreateBy.Text  = CommonCtrl.IsNullToString(dr["create_by_name"]);
                long createTime = Convert.ToInt64(CommonCtrl.IsNullToString(dr["create_time"]));
                lblCreateTime.Text = Common.UtcLongToLocalDateTime(createTime).ToString();
                lblNation.Text     = CommonCtrl.IsNullToString(dr["nation_name"]);
                lblRemark.Text     = CommonCtrl.IsNullToString(dr["remark"]);
                string sex = CommonCtrl.IsNullToString(dr["sex"]);
                lblSex.Text          = sex == "1" ? "男" : "女";
                llblCustomer.Visible = CommonCtrl.IsNullToString(dr["cust_count"]).Length > 0;
                llblVehicle.Visible  = CommonCtrl.IsNullToString(dr["vehi_count"]).Length > 0;
                llblSupplier.Visible = CommonCtrl.IsNullToString(dr["supp_count"]).Length > 0;
            }
            SetDataViewBtn();
        }
예제 #3
0
        /// <summary>
        /// 选择联系人后,获取所选择的联系人信息
        /// </summary>
        private DataTable GetContacts(string contactsId)
        {
            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        = DBHelper.GetTable("查询一条联系人信息", TableName, string.Format("*,{0} phone", EncryptByDB.GetDesFieldValue("cont_phone")), " cont_id='" + contactsId + "'", "", "");

            return(dt);
        }
예제 #4
0
        //绑定数据
        private void BindData()
        {
            StringBuilder sbWhere = new StringBuilder();//条件

            sbWhere.AppendFormat(" create_time between {0} and {1}", Common.LocalDateTimeToUtcLong(DateTime.Parse(diCreate.StartDate).Date),
                                 Common.LocalDateTimeToUtcLong(DateTime.Parse(diCreate.EndDate).Date.AddDays(1).AddMilliseconds(-1)));
            sbWhere.AppendFormat(" and enable_flag='{0}'", (int)DataSources.EnumEnableFlag.USING); //标识未删除
            string name = txtContName.Caption.Trim();                                              //联系人名

            if (name.Length > 0)
            {
                sbWhere.AppendFormat(" and cont_name like '%{0}%'", name);
            }
            string post = CommonCtrl.IsNullToString(cboContPost.SelectedValue);//职务

            if (post.Length > 0)
            {
                sbWhere.AppendFormat(" and cont_post='{0}'", post);
            }
            //string isDefault = CommonCtrl.IsNullToString(cboDefault.SelectedValue);//是否默认
            //if (isDefault.Length > 0)
            //{
            //    sbWhere.AppendFormat(" and is_default='{0}'", isDefault);
            //}
            string sex = CommonCtrl.IsNullToString(cboSex.SelectedValue);//性别

            if (sex.Length > 0)
            {
                sbWhere.AppendFormat(" and sex='{0}'", sex);
            }
            string dianhua = txtDianHua.Caption.Trim();//电话

            if (dianhua.Length > 0)
            {
                //sbWhere.AppendFormat(" and (cont_phone like '%{0}%' or cont_tel like '%{0}%')", dianhua);
                sbWhere.AppendFormat(" and ({1} like '%{0}%' or {2} like '%{0}%')", dianhua, EncryptByDB.GetDesFieldValue("cont_phone"), EncryptByDB.GetDesFieldValue("cont_tel"));
            }
            string relation = CommonCtrl.IsNullToString(cboAffiliation.SelectedValue);//归属类型

            switch (relation)
            {
            case "1":
                sbWhere.AppendFormat(" and isnull(cust_count,0)>0");    //客户类型
                break;

            case "2":
                sbWhere.AppendFormat(" and isnull(vehi_count,0)>0");    //车辆类型
                break;

            case "3":
                sbWhere.AppendFormat(" and isnull(supp_count,0)>0");    //供应商类型
                break;
            }
            int       recordCount;//总数量
            DataTable dt = DBHelper.GetTableByPage("联系人查询", "v_contacts", string.Format("*,{0} phone", EncryptByDB.GetDesFieldValue("cont_phone")), sbWhere.ToString(), "", "order by create_time desc", page.PageIndex, page.PageSize, out recordCount);

            dgvContacts.RowCount = 0;
            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    DataGridViewRow dgvr = dgvContacts.Rows[dgvContacts.Rows.Add()];
                    dgvr.Cells["colContID"].Value   = dr["cont_id"];
                    dgvr.Cells["colContName"].Value = dr["cont_name"];
                    string sexName = CommonCtrl.IsNullToString(dr["sex"]);
                    if (sexName == "1")
                    {
                        dgvr.Cells["colSex"].Value = "男";
                    }
                    else if (sexName == "0")
                    {
                        dgvr.Cells["colSex"].Value = "女";
                    }

                    dgvr.Cells["colContPost"].Value  = dr["cont_post_name"];
                    dgvr.Cells["colNation"].Value    = dr["nation_name"];
                    dgvr.Cells["colContPhone"].Value = dr["phone"];
                    dgvr.Cells["colContTel"].Value   = dr["cont_tel"];
                    //string isdefault = CommonCtrl.IsNullToString(dr["is_default"]);
                    //dgvr.Cells["colIsDefault"].Value = isdefault == "1" ? "是" : "否";
                    string relationName = string.Empty;//归属类型
                    if (CommonCtrl.IsNullToString(dr["cust_count"]).Length > 0)
                    {
                        relationName = "客户联系人";
                    }
                    if (CommonCtrl.IsNullToString(dr["vehi_count"]).Length > 0)
                    {
                        if (relationName.Length > 0)
                        {
                            relationName += ",";
                        }
                        relationName += "车辆联系人";
                    }
                    if (CommonCtrl.IsNullToString(dr["supp_count"]).Length > 0)
                    {
                        if (relationName.Length > 0)
                        {
                            relationName += ",";
                        }
                        relationName += "供应商联系人";
                    }
                    //dgvr.Cells["colAffiliation"].Value = relationName;
                    dgvr.Cells["colDataSources"].Value  = DataSources.GetDescription(typeof(DataSources.EnumDataSources), dr["data_source"]);
                    dgvr.Cells[colDataSources.Name].Tag = dr["data_source"];
                    string createTime = CommonCtrl.IsNullToString(dr["create_time"]);
                    if (createTime.Length > 0)
                    {
                        dgvr.Cells["colCreateTime"].Value = Common.UtcLongToLocalDateTime(Convert.ToInt64(createTime));
                    }
                    //dgvr.Cells[colStatus.Name].Value = dr["status"];
                    dgvr.Cells[colStatus.Name].Value = DataSources.GetDescription(typeof(DataSources.EnumStatus), dr["status"]);
                    dgvr.Cells[colStatus.Name].Tag   = dr["status"];
                }
                page.RecordCount = recordCount;
                page.SetBtnState();
            }
        }
예제 #5
0
        private void addUser_Click(object sender, EventArgs e)
        {
            frmContacts  contact = new frmContacts();
            DialogResult result  = contact.ShowDialog();

            if (result == DialogResult.OK)
            {
                DataTable dut = DBHelper.GetTable("获取联系人(司机)", "tb_contacts", string.Format("*,{0} phone, {1} tel,{2} email", EncryptByDB.GetDesFieldValue("cont_phone"), EncryptByDB.GetDesFieldValue("cont_tel"), EncryptByDB.GetDesFieldValue("cont_email")), "cont_id='" + contact.contID + "'", "", " order by cont_id desc");
                if (dut.Rows.Count > 0)
                {
                    DataRow dpr = dut.Rows[0];
                    if (listUser.Contains(CommonCtrl.IsNullToString(dpr["cont_name"])))
                    {
                        MessageBoxEx.Show("此司机信息已存在,请选择其他司机", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    dgvUser.CurrentRow.Cells["cont_name"].Value     = CommonCtrl.IsNullToString(dpr["cont_name"]);
                    dgvUser.CurrentRow.Cells["cont_post"].Value     = GetDicName(CommonCtrl.IsNullToString(dpr["cont_post"]));
                    dgvUser.CurrentRow.Cells["cont_phone"].Value    = CommonCtrl.IsNullToString(dpr["phone"]);
                    dgvUser.CurrentRow.Cells["cont_tel"].Value      = CommonCtrl.IsNullToString(dpr["tel"]);
                    dgvUser.CurrentRow.Cells["cont_email"].Value    = CommonCtrl.IsNullToString(dpr["email"]);
                    dgvUser.CurrentRow.Cells["cont_birthday"].Value = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dpr["cont_birthday"])) ? Common.UtcLongToLocalDateTime(Convert.ToInt64(CommonCtrl.IsNullToString(dpr["cont_birthday"]))).ToString() : "";
                    dgvUser.CurrentRow.Cells["remark"].Value        = CommonCtrl.IsNullToString(dpr["remark"]);
                    dgvUser.CurrentRow.Cells["cont_id"].Value       = CommonCtrl.IsNullToString(dpr["cont_id"]);
                    dgvUser.Rows.Add(1);
                    listUser.Add(CommonCtrl.IsNullToString(dpr["cont_name"]));
                }
            }
        }
예제 #6
0
        /// <summary>
        /// 根据车辆档案ID获取信息,复制和编辑用
        /// </summary>
        private void BindData()
        {
            #region 基础信息
            string    strWhere = string.Format("a.v_id='{0}'", strId);
            DataTable dt       = DBHelper.GetTable("查询车辆档案", "tb_vehicle a left join attachment_info m on a.v_id = m.relation_object_id", "*", strWhere, "", "");
            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }
            DataRow dr = dt.Rows[0];
            txtCarNO.Caption          = CommonCtrl.IsNullToString(dr["license_plate"]);        //车牌号
            cobCarBrand.SelectedValue = CommonCtrl.IsNullToString(dr["v_brand"]);              //车辆品牌;
            cobFactory.SelectedValue  = CommonCtrl.IsNullToString(dr["v_factory"]);            //生产厂家
            txtVIN.Caption            = CommonCtrl.IsNullToString(dr["vin"]);                  //VIN
            txtYardCode.Caption       = CommonCtrl.IsNullToString(dr["car_factory_num"]);      //车场编号
            cobColor.SelectedValue    = CommonCtrl.IsNullToString(dr["v_color"]);              //颜色
            txtCarType.Text           = GetVmodel(CommonCtrl.IsNullToString(dr["v_model"]));   //车型
            txtCarType.Tag            = CommonCtrl.IsNullToString(dr["v_model"]);              //车型
            cobRating.SelectedValue   = CommonCtrl.IsNullToString(dr["v_class"]);              //车辆等级
            txtCustomNO.Tag           = CommonCtrl.IsNullToString(dr["cust_id"]);              //所属客户id
            txtCustomNO.Text          = GetCustName(CommonCtrl.IsNullToString(dr["cust_id"])); //所属客户
            if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["carbuy_date"])))
            {
                long Rticks = Convert.ToInt64(CommonCtrl.IsNullToString(dr["carbuy_date"]));
                dtpSTime.Value = Common.UtcLongToLocalDateTime(Rticks);  //购车日期
            }
            txtRemark.Caption = CommonCtrl.IsNullToString(dr["remark"]); //备注
            #endregion

            #region 车辆信息
            txtv_long.Caption           = CommonCtrl.IsNullToString(dr["v_long"]);           //车长
            txtv_wide.Caption           = CommonCtrl.IsNullToString(dr["v_wide"]);           //车宽
            txtv_high.Caption           = CommonCtrl.IsNullToString(dr["v_high"]);           //车高
            txtaxle_count.Caption       = CommonCtrl.IsNullToString(dr["axle_count"]);       //轴数
            txtaxle_distance.Caption    = CommonCtrl.IsNullToString(dr["axle_distance"]);    //轴距
            txtwheel_distance.Caption   = CommonCtrl.IsNullToString(dr["wheel_distance"]);   //轮距
            txttotal_quality.Caption    = CommonCtrl.IsNullToString(dr["total_quality"]);    //总质量
            txtapproved_quality.Caption = CommonCtrl.IsNullToString(dr["approved_quality"]); //核定质量
            txtengine_factory.Caption   = CommonCtrl.IsNullToString(dr["engine_factory"]);   //发动机厂家
            txtengine_model.Caption     = CommonCtrl.IsNullToString(dr["engine_model"]);     //发动机型号
            txtengine_num.Caption       = CommonCtrl.IsNullToString(dr["engine_num"]);       //发动机号
            txtdischarge.Caption        = CommonCtrl.IsNullToString(dr["discharge"]);        //排量
            txtfuel_type.Caption        = CommonCtrl.IsNullToString(dr["fuel_type"]);        //燃油类型
            txtair_factory.Caption      = CommonCtrl.IsNullToString(dr["air_factory"]);      //空调厂家
            txtair_model.Caption        = CommonCtrl.IsNullToString(dr["air_model"]);        //空调型号
            txtair_num.Caption          = CommonCtrl.IsNullToString(dr["air_num"]);          //空调编码
            txtaxle_factory.Caption     = CommonCtrl.IsNullToString(dr["axle_factory"]);     //车桥厂家
            txtaxle_model.Caption       = CommonCtrl.IsNullToString(dr["axle_model"]);       //车桥型号
            txtaxle_num.Caption         = CommonCtrl.IsNullToString(dr["axle_num"]);         //车桥编号
            txtlowdisc_factory.Caption  = CommonCtrl.IsNullToString(dr["lowdisc_factory"]);  //底盘厂家
            txtwheel_count.Caption      = CommonCtrl.IsNullToString(dr["wheel_count"]);      //轮胎数
            txtwheel_factory.Caption    = CommonCtrl.IsNullToString(dr["wheel_factory"]);    //轮胎厂家
            txtwheel_model.Caption      = CommonCtrl.IsNullToString(dr["wheel_model"]);      //轮胎型号
            txtshift_factory.Caption    = CommonCtrl.IsNullToString(dr["shift_factory"]);    //变速箱厂家
            txtshift_model.Caption      = CommonCtrl.IsNullToString(dr["shift_model"]);      //变速箱型号
            txtshift_num.Caption        = CommonCtrl.IsNullToString(dr["shift_num"]);        //变速箱号
            txtshift_type.Caption       = CommonCtrl.IsNullToString(dr["shift_type"]);       //变速箱类型
            txtgps_factory.Caption      = CommonCtrl.IsNullToString(dr["gps_factory"]);      //GPS厂家
            txtgps_model.Caption        = CommonCtrl.IsNullToString(dr["gps_model"]);        //GPS型号
            txtgps_num.Caption          = CommonCtrl.IsNullToString(dr["gps_num"]);          //GPS编号
            txtdvr_factory.Caption      = CommonCtrl.IsNullToString(dr["dvr_factory"]);      //DVR厂家
            txtdvr_model.Caption        = CommonCtrl.IsNullToString(dr["dvr_model"]);        //DVR型号
            txtdvr_num.Caption          = CommonCtrl.IsNullToString(dr["dvr_num"]);          //DVR编号
            string photoPath = CommonCtrl.IsNullToString(dr["att_path"]);
            photo   = photoPath;
            photoID = CommonCtrl.IsNullToString(dr["att_id"]);
            picPhoto.BackgroundImage = FileOperation.DownLoadImage(photoPath);//图片信息
            picPhoto.ImageLocation   = photoPath;
            #endregion

            #region 底部datagridview数据

            #region 驾驶员信息
            //驾驶员信息
            DataTable dpt = DBHelper.GetTable("驾驶员信息", "tr_driver_vehicle", "*", string.Format(" v_id='{0}'", strId), "", "");
            if (dpt.Rows.Count > 0)
            {
                string strConId = string.Empty;//联系人Id
                for (int i = 0; i < dpt.Rows.Count; i++)
                {
                    DataRow dur = dpt.Rows[i];
                    strConId += "'" + CommonCtrl.IsNullToString(dur["driver_id"]) + "'" + ",";
                }

                #region 从联系人信息中读取驾驶员信息
                strConId = strConId.Substring(0, strConId.Length - 1);
                if (!string.IsNullOrEmpty(strConId))
                {
                    DataTable dut = DBHelper.GetTable("联系人信息", "tb_contacts", string.Format("*,{0} phone, {1} tel", EncryptByDB.GetDesFieldValue("cont_phone"), EncryptByDB.GetDesFieldValue("cont_tel")), "cont_id in (" + strConId + ")", "", "order by cont_id desc");
                    if (dut.Rows.Count > dgvUser.Rows.Count)
                    {
                        dgvUser.Rows.Add(dut.Rows.Count - dgvUser.Rows.Count + 1);
                    }
                    for (int j = 0; j < dut.Rows.Count; j++)
                    {
                        DataRow dpr = dut.Rows[j];
                        dgvUser.Rows[j].Cells["cont_name"].Value     = CommonCtrl.IsNullToString(dpr["cont_name"]);
                        dgvUser.Rows[j].Cells["cont_post"].Value     = GetDicName(CommonCtrl.IsNullToString(dpr["cont_post"]));
                        dgvUser.Rows[j].Cells["cont_phone"].Value    = CommonCtrl.IsNullToString(dpr["phone"]);
                        dgvUser.Rows[j].Cells["cont_tel"].Value      = CommonCtrl.IsNullToString(dpr["tel"]);
                        dgvUser.Rows[j].Cells["cont_email"].Value    = CommonCtrl.IsNullToString(dpr["cont_email"]);
                        dgvUser.Rows[j].Cells["cont_birthday"].Value = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dpr["cont_birthday"])) ? Common.UtcLongToLocalDateTime(Convert.ToInt64(CommonCtrl.IsNullToString(dpr["cont_birthday"]))).ToString() : "";
                        dgvUser.Rows[j].Cells["remark"].Value        = CommonCtrl.IsNullToString(dpr["remark"]);
                        dgvUser.Rows[j].Cells["cont_id"].Value       = CommonCtrl.IsNullToString(dpr["cont_id"]);
                        DataRow dur = dpt.Rows[j];
                        dgvUser.Rows[j].Cells["dir_v_id"].Value = CommonCtrl.IsNullToString(dur["dir_v_id"]);
                        string strDefault = CommonCtrl.IsNullToString(dur["isDefault"]);
                        if (!string.IsNullOrEmpty(strDefault))
                        {
                            dgvUser.Rows[j].Cells[isDefault.Name].Value = strDefault == "1"? true:false;
                        }
                    }
                }
                #endregion
            }
            #endregion
            //附件信息数据
            ucAttr.TableName         = "tb_vehicle";
            ucAttr.TableNameKeyValue = strId;
            ucAttr.BindAttachment();

            #endregion
        }
예제 #7
0
        private void BindContacts() //绑定联系人
        {
            #region 联系人数据

            //联系人数据
            try
            {
                var dpt = DBHelper.GetTable("联系人数据", "(select tr.relation_object_id, tr.is_default tr_is_default, tb.*  from tb_contacts tb inner join tr_base_contacts tr on tb.cont_id = tr.cont_id) a", string.Format("*,{0} phone", EncryptByDB.GetDesFieldValue("cont_phone")),
                                            string.Format(" a.relation_object_id='{0}'", CustId), "", "");
                if (dpt != null && dpt.Rows.Count > 0)
                {
                    for (var i = 0; i < dpt.Rows.Count; i++)
                    {
                        var dpr = dpt.Rows[i];
                        //dgvcontacts.Rows[i].Cells["cont_id"].Value = CommonCtrl.IsNullToString(dpr["cont_id"]);
                        //dgvcontacts.Rows[i].Cells["cont_name"].Value = CommonCtrl.IsNullToString(dpr["cont_name"]);
                        //dgvcontacts.Rows[i].Cells["cont_post"].Value = CommonCtrl.IsNullToString(dpr["cont_post"]);
                        //dgvcontacts.Rows[i].Cells["cont_phone"].Value = CommonCtrl.IsNullToString(dpr["phone"]);
                        if (CommonCtrl.IsNullToString(dpr["tr_is_default"]) == "1")
                        {
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            #endregion
        }
예제 #8
0
        //保存数据
        private void Save()
        {
            #region 验证数据输入的正确性
            string name = txtContName.Caption.Trim();
            if (name.Length == 0)
            {
                MessageBoxEx.Show("请填写联系人姓名!");
                txtContName.Focus();
                return;
            }
            if (cboContPost.SelectedValue == null)
            {
                MessageBoxEx.Show("请选择职务!");
                cboContPost.Focus();
                return;
            }
            string email = txtContEmail.Caption.Trim();
            //验证email
            if (email.Length != 0)
            {
                if (!Utility.Common.Validator.IsEmail(email))
                {
                    MessageBoxEx.Show("email验证错误,请填写正确的email");
                    txtContEmail.Focus();
                    return;
                }
            }
            //验证手机号
            string phone = txtContPhone.Caption.Trim();
            if (phone.Length > 0)
            {
                if (!Utility.Common.Validator.IsMobile(phone))
                {
                    MessageBoxEx.Show("手机号输入有误,请输入正确的手机号");
                    txtContPhone.Focus();
                    return;
                }
            }
            #endregion

            if (MessageBoxEx.Show("确认要保存吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return;
            }
            #region  加密
            //Dictionary<string, string> dic = new Dictionary<string, string>();
            //dic.Add("cont_name", name);//姓名
            //dic.Add("cont_post", cboContPost.SelectedValue.ToString());//职务
            //dic.Add("cont_phone",EncryptByDB.GetEncFieldValue( phone));//手机
            //dic.Add("cont_tel", txtContTel.Caption);//电话
            //dic.Add("cont_email", email);//email
            //dic.Add("sex", rbMan.Checked?"1":"0");//性别
            //dic.Add("nation", CommonCtrl.IsNullToString(cboNation.SelectedValue));//民族
            ////dic.Add("is_default", chkIsDefault.Checked ? "1" : "0");//是否默认
            //dic.Add("remark", txtRemark.Caption);//备注
            //dic.Add("enable_flag", ((int)DataSources.EnumEnableFlag.USING).ToString());//标识未删除
            ////判断窗体状态
            //if (status == WindowStatus.Add || status == WindowStatus.Copy)
            //{
            //    dic.Add("status", ((int)DataSources.EnumStatus.Start).ToString());
            //    dic.Add("data_source", ((int)DataSources.EnumDataSources.SELFBUILD).ToString());
            //    dic.Add("cont_id", Guid.NewGuid().ToString());
            //    dic.Add("create_by", GlobalStaticObj.UserID);
            //    dic.Add("create_time", DateTime.UtcNow.Ticks.ToString());
            //    if (DBHelper.Submit_AddOrEdit("新增联系人", "tb_contacts", "", "", dic))
            //    {
            //        MessageBoxEx.Show("保存成功!");
            //        uc.BindData(contID);
            //        deleteMenuByTag(this.Tag.ToString(), uc.Name);
            //    }
            //    else
            //    {
            //        MessageBoxEx.Show("保存失败!");
            //    }
            //}
            //else if (status == WindowStatus.Edit)//编辑
            //{
            //    dic.Add("update_by", GlobalStaticObj.UserID);
            //    dic.Add("update_time", DateTime.UtcNow.Ticks.ToString());
            //    if (DBHelper.Submit_AddOrEdit("修改联系人", "tb_contacts", "cont_id", contID, dic))
            //    {
            //        MessageBoxEx.Show("修改成功!");
            //        uc.BindData(contID);
            //        deleteMenuByTag(this.Tag.ToString(), uc.Name);
            //    }
            //    else
            //    {
            //        MessageBoxEx.Show("修改失败!");
            //    }
            //}
            #endregion
            Dictionary <string, ParamObj> dic = new Dictionary <string, ParamObj>();
            //dic.Add("cont_name",new ParamObj("cont_name", name,SysDbType.NVarChar,40));//姓名
            //dic.Add("cont_post", new ParamObj("cont_post", cboContPost.SelectedValue, SysDbType.NVarChar, 40));//职务
            //dic.Add("cont_phone",new ParamObj("cont_phone", EncryptByDB.GetEncFieldValue(phone),SysDbType.varbi);//手机
            //dic.Add("cont_tel", txtContTel.Caption);//电话
            //dic.Add("cont_email", email);//email
            //dic.Add("sex", rbMan.Checked ? "1" : "0");//性别
            //dic.Add("nation", CommonCtrl.IsNullToString(cboNation.SelectedValue));//民族
            ////dic.Add("is_default", chkIsDefault.Checked ? "1" : "0");//是否默认
            //dic.Add("remark", txtRemark.Caption);//备注
            //dic.Add("enable_flag", ((int)DataSources.EnumEnableFlag.USING).ToString());//标识未删除
            List <SysSQLString> listSql = new List <SysSQLString>();
            SysSQLString        sysSql  = new SysSQLString();
            sysSql.cmdType = CommandType.Text;
            sysSql.Param   = new Dictionary <string, string>();
            //判断窗体状态
            if (status == WindowStatus.Add || status == WindowStatus.Copy)
            {
                //dic.Add("status", ((int)DataSources.EnumStatus.Start).ToString());
                //dic.Add("data_source", ((int)DataSources.EnumDataSources.SELFBUILD).ToString());
                //dic.Add("cont_id", Guid.NewGuid().ToString());
                //dic.Add("create_by", GlobalStaticObj.UserID);
                //dic.Add("create_time", DateTime.UtcNow.Ticks.ToString());
                string cont_id = Guid.NewGuid().ToString();
                sysSql.sqlString = string.Format(@"INSERT INTO [tb_contacts]
           ([cont_id]
           ,[cont_name]
           ,[cont_post]
           ,[cont_tel]
           ,[cont_email]
           ,[sex]
           ,[nation]
           ,[remark]
           ,[enable_flag]
           ,[data_source]
           ,[status]
           ,[create_by]
           ,[create_time]
           ,[cont_phone])
     VALUES
           ('{0}','{1}','{2}',{3},'{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}',{12},{13})",
                                                 cont_id.ToString(), name, cboContPost.SelectedValue,
                                                 EncryptByDB.GetEncFieldValue(txtContTel.Caption), email, rbMan.Checked ? "1" : "0", cboNation.SelectedValue, txtRemark.Caption, (int)DataSources.EnumEnableFlag.USING,
                                                 (int)DataSources.EnumStatus.Start, (int)DataSources.EnumDataSources.SELFBUILD, GlobalStaticObj.UserID,
                                                 Common.LocalDateTimeToUtcLong(DateTime.Now), EncryptByDB.GetEncFieldValue(phone));
                listSql.Add(sysSql);
                if (DBHelper.BatchExeSQLStringMultiByTrans("新增联系人", listSql))
                {
                    //Model.tb_contacts_ex tb_contacts=new Model.tb_contacts_ex ();
                    //tb_contacts.cont_email = txtContEmail.Caption.Trim();
                    //tb_contacts.cont_id = cont_id;
                    //tb_contacts.cont_name = txtContName.Caption.Trim();
                    //tb_contacts.cont_phone = txtContPhone.Caption.Trim();
                    //tb_contacts.cont_post = cboContPost.SelectedValue.ToString();
                    //tb_contacts.cont_tel = txtContTel.Caption.Trim();
                    //DBHelper.WebServHandler("", EnumWebServFunName.UpLoadCcontact, tb_contacts);
                    MessageBoxEx.Show("保存成功!");
                    uc.BindData(contID);
                    deleteMenuByTag(this.Tag.ToString(), uc.Name);
                }
                else
                {
                    MessageBoxEx.Show("保存失败!");
                }
            }
            else if (status == WindowStatus.Edit)//编辑
            {
                //dic.Add("update_by", GlobalStaticObj.UserID);
                //dic.Add("update_time", DateTime.UtcNow.Ticks.ToString());
                //if (DBHelper.Submit_AddOrEdit("修改联系人", "tb_contacts", "cont_id", contID, dic))
                //{
                //    MessageBoxEx.Show("修改成功!");
                //    uc.BindData(contID);
                //    deleteMenuByTag(this.Tag.ToString(), uc.Name);
                //}
                //else
                //{
                //    MessageBoxEx.Show("修改失败!");
                //}
                sysSql.sqlString = string.Format(@"update tb_contacts set cont_name='{0}',cont_post='{1}',cont_phone={2},cont_tel={3},cont_email='{4}',sex='{5}',
                                    nation='{6}',remark='{7}',update_by='{8}',update_time='{9}' where cont_id='{10}'", name, cboContPost.SelectedValue, EncryptByDB.GetEncFieldValue(phone),
                                                 EncryptByDB.GetEncFieldValue(txtContTel.Caption.Trim()), email, rbMan.Checked ? "1" : "0", cboNation.SelectedValue, txtRemark.Caption,
                                                 GlobalStaticObj.UserID, Common.LocalDateTimeToUtcLong(DateTime.Now), contID);
                listSql.Add(sysSql);
                if (DBHelper.BatchExeSQLStrMultiByTransNoLogNoBackup("修改联系人", listSql))
                {
                    MessageBoxEx.Show("修改成功!");
                    uc.BindData(contID);
                    deleteMenuByTag(this.Tag.ToString(), uc.Name);
                }
                else
                {
                    MessageBoxEx.Show("修改失败!");
                }
            }
        }
예제 #9
0
        private void BindContacts() //绑定联系人
        {
            #region 联系人数据

            try
            {
                //联系人数据
                var dpt = DBHelper.GetTable("联系人数据", "(select tr.relation_object_id, tr.is_default tr_is_default, tb.*  from tb_contacts tb inner join tr_base_contacts tr on tb.cont_id = tr.cont_id) a", string.Format("*,{0} phone ,{1} tel", EncryptByDB.GetDesFieldValue("cont_phone"), EncryptByDB.GetDesFieldValue("cont_tel")),
                                            string.Format(" a.relation_object_id='{0}'", Id), "", "");
                if (dpt != null && dpt.Rows.Count > 0)
                {
                    if (dpt.Rows.Count > dgvcontacts.Rows.Count)
                    {
                        dgvcontacts.Rows.Add(dpt.Rows.Count + 1 - dgvcontacts.Rows.Count);
                    }
                    for (var i = 0; i < dpt.Rows.Count; i++)
                    {
                        var dpr = dpt.Rows[i];
                        dgvcontacts.Rows[i].Cells["cont_id"].Value       = CommonCtrl.IsNullToString(dpr["cont_id"]);
                        dgvcontacts.Rows[i].Cells["cont_name"].Value     = CommonCtrl.IsNullToString(dpr["cont_name"]);
                        dgvcontacts.Rows[i].Cells["cont_post"].Value     = CommonCtrl.IsNullToString(dpr["cont_post"]);
                        dgvcontacts.Rows[i].Cells["cont_phone"].Value    = CommonCtrl.IsNullToString(dpr["phone"]);
                        dgvcontacts.Rows[i].Cells["cont_tel"].Value      = CommonCtrl.IsNullToString(dpr["tel"]);
                        dgvcontacts.Rows[i].Cells["cont_birthday"].Value = CommonCtrl.IsNullToString(dpr["cont_birthday"]);
                        dgvcontacts.Rows[i].Cells["cont_email"].Value    = CommonCtrl.IsNullToString(dpr["cont_email"]);
                        dgvcontacts.Rows[i].Cells["is_default"].Value    = CommonCtrl.IsNullToString(dpr["tr_is_default"]);
                        dgvcontacts.Rows[i].Cells["remark"].Value        = CommonCtrl.IsNullToString(dpr["remark"]);
                    }
                }
            }
            catch (Exception ex)
            {
                UCCustomerManager.LogService4Customer.WriteLog(1, ex);
            }
            #endregion
        }
예제 #10
0
        void UCCustomerAddOrEdit_SaveEvent(object sender, EventArgs e)  //数据保存
        {
            try
            {
                if (!CheckControlValue())
                {
                    return;
                }
                var sysSqlStrList = new List <SysSQLString>();

                var custSql = BuildCustomerSqlString();
                sysSqlStrList.Add(custSql.Item1);
                sysSqlStrList.AddRange(BuildContactRelation(custSql.Item2));
                sysSqlStrList.AddRange(BuildVehicleRelation(custSql.Item2));
                sysSqlStrList.AddRange(BuildVipMemberSqlString(custSql.Item2));

                //ucAttr.GetAttachmentSql(sysSqlStrList);   //保存附件时失败...目前保留此代码
                var opName = wStatus == WindowStatus.Edit ? "更新客户档案" : "新增客户档案";
                var result = DBHelper.BatchExeSQLStringMultiByTrans(opName, sysSqlStrList);
                if (result)
                {
                    var customer = new tb_customer();
                    customer.cust_id           = custSql.Item1.Param["cust_id"];
                    customer.cust_code         = custSql.Item1.Param["cust_code"];
                    customer.cust_name         = custSql.Item1.Param["cust_name"];
                    customer.cust_short_name   = custSql.Item1.Param["cust_short_name"];
                    customer.cust_quick_code   = custSql.Item1.Param["cust_quick_code"];
                    customer.cust_type         = custSql.Item1.Param["cust_type"];
                    customer.legal_person      = custSql.Item1.Param["legal_person"];
                    customer.enterprise_nature = custSql.Item1.Param["enterprise_nature"];
                    customer.cust_tel          = custSql.Item1.Param["cust_tel"];
                    customer.cust_fax          = custSql.Item1.Param["cust_fax"];
                    customer.cust_email        = custSql.Item1.Param["cust_email"];
                    customer.cust_phone        = custSql.Item1.Param["cust_phone"];
                    customer.cust_website      = custSql.Item1.Param["cust_website"];
                    customer.province          = custSql.Item1.Param["province"];
                    customer.city                  = custSql.Item1.Param["city"];
                    customer.county                = custSql.Item1.Param["county"];
                    customer.cust_address          = custSql.Item1.Param["cust_address"];
                    customer.zip_code              = custSql.Item1.Param["zip_code"];
                    customer.tax_num               = custSql.Item1.Param["tax_num"];
                    customer.indepen_legalperson   = custSql.Item1.Param["indepen_legalperson"];
                    customer.credit_rating         = custSql.Item1.Param["credit_rating"];
                    customer.credit_line           = Convert.ToInt32(custSql.Item1.Param["credit_line"]);
                    customer.credit_account_period = Convert.ToInt32(custSql.Item1.Param["credit_account_period"]);
                    customer.price_type            = custSql.Item1.Param["price_type"];
                    customer.billing_name          = custSql.Item1.Param["billing_name"];
                    customer.billing_address       = custSql.Item1.Param["billing_address"];
                    customer.billing_account       = custSql.Item1.Param["billing_account"];
                    customer.open_bank             = custSql.Item1.Param["open_bank"];
                    customer.bank_account          = custSql.Item1.Param["bank_account"];
                    customer.bank_account_person   = custSql.Item1.Param["bank_account_person"];
                    customer.cust_remark           = custSql.Item1.Param["cust_remark"];
                    customer.is_member             = custSql.Item1.Param["is_member"];
                    customer.member_number         = custSql.Item1.Param["member_number"];
                    customer.member_class          = custSql.Item1.Param["member_class"];
                    if (rdbis_member_y.Checked)
                    {
                        customer.member_period_validity = Convert.ToInt64(custSql.Item1.Param["member_period_validity"]);
                    }
                    customer.status        = custSql.Item1.Param["status"];
                    customer.enable_flag   = custSql.Item1.Param["enable_flag"];
                    customer.data_source   = custSql.Item1.Param["data_source"];
                    customer.cust_crm_guid = custSql.Item1.Param["cust_crm_guid"];

                    customer.accessories_discount = 0;
                    customer.workhours_discount   = 0;
                    customer.country             = custSql.Item1.Param["country"];
                    customer.indepen_legalperson = custSql.Item1.Param["indepen_legalperson"];
                    customer.market_segment      = custSql.Item1.Param["market_segment"];
                    customer.institution_code    = custSql.Item1.Param["institution_code"];
                    customer.com_constitution    = custSql.Item1.Param["com_constitution"];
                    customer.registered_capital  = custSql.Item1.Param["registered_capital"];
                    customer.vehicle_structure   = custSql.Item1.Param["vehicle_structure"];
                    customer.agency            = custSql.Item1.Param["agency"];
                    customer.sap_code          = custSql.Item1.Param["sap_code"];
                    customer.business_scope    = custSql.Item1.Param["business_scope"];
                    customer.ent_qualification = custSql.Item1.Param["ent_qualification"];


                    if (wStatus == WindowStatus.Edit)
                    {
                        customer.update_by   = custSql.Item1.Param["update_by"];
                        customer.update_time = Convert.ToInt64(custSql.Item1.Param["update_time"]);
                    }
                    else
                    {
                        customer.create_time = Convert.ToInt64(custSql.Item1.Param["create_time"]);
                        customer.create_by   = custSql.Item1.Param["create_by"];
                    }
                    var flag = DBHelper.WebServHandler(opName, EnumWebServFunName.UpLoadCustomer, customer);
                    if (String.IsNullOrEmpty(flag))
                    {
                        var contactSql = BuildContactRelation(custSql.Item2).ToArray();
                        foreach (var sysSqlString in contactSql)
                        {
                            if (!sysSqlString.Param.ContainsKey("cont_id"))
                            {
                                continue;
                            }
                            var contId = sysSqlString.Param["cont_id"];
                            var dt1    = DBHelper.GetTable("获取客户CRMID", "tb_customer", "*", String.Format("cust_id = '{0}'", customer.cust_id), "", "");
                            var dt     = DBHelper.GetTable("根据客户档案获取联系信息", "v_contacts", string.Format("*,{0} phone", EncryptByDB.GetDesFieldValue("cont_phone")), " cont_id = '" + contId + "'", "", "");
                            if (dt.DefaultView != null && dt.DefaultView.Count > 0)
                            {
                                var cont = new tb_contacts_ex
                                {
                                    cont_id         = CommonCtrl.IsNullToString(dt.DefaultView[0]["cont_id"]),
                                    cont_name       = CommonCtrl.IsNullToString(dt.DefaultView[0]["cont_name"]),
                                    cont_post       = CommonCtrl.IsNullToString(dt.DefaultView[0]["cont_post_name"]),
                                    cont_phone      = CommonCtrl.IsNullToString(dt.DefaultView[0]["phone"]),
                                    nation          = CommonCtrl.IsNullToString(dt.DefaultView[0]["nation_name"]),
                                    parent_customer = CommonCtrl.IsNullToString(dt1.DefaultView[0]["cust_crm_guid"]),
                                    //alter by 杨超逸
                                    //2014.12.26
                                    //宇通借口男女性别上传数据修改联系人时,性别传1(男)和2(女)
                                    //sex = CommonCtrl.IsNullToString(dt.DefaultView[0]["sex"]),
                                    sex = UpSex(dt.DefaultView[0]["sex"]),
                                    //alter end
                                    status           = CommonCtrl.IsNullToString(dt.DefaultView[0]["status"]),
                                    cont_post_remark = CommonCtrl.IsNullToString(dt.DefaultView[0]["post_remark"]),
                                    cont_crm_guid    = CommonCtrl.IsNullToString(dt.DefaultView[0]["cont_crm_guid"]),
                                    contact_type     = "01" //标识类型为联系人
                                };
                                var flag4Cont = DBHelper.WebServHandler(opName, EnumWebServFunName.UpLoadCcontact, cont);
                                if (String.IsNullOrEmpty(flag4Cont))
                                {
                                    //do something
                                }
                            }
                        }
                    }
                    MessageBoxEx.Show("保存成功!", "保存");
                    UCCustomerManager.BindPageData();
                    deleteMenuByTag(Tag.ToString(), UCCustomerManager.Name);
                }
                else
                {
                    MessageBoxEx.Show("保存失败!", "保存");
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show("保存失败!" + ex.Message, "提示");
            }
        }
예제 #11
0
        private void InitDataGridCellFormatting()   //初始化数据表格
        {
            try
            {
                dgvVehicle.CellFormatting += delegate(object sender, DataGridViewCellFormattingEventArgs args)
                {
                    UIAssistants.DgvCellDataConvert2DicData(dgvVehicle, args, "v_brand");
                    UIAssistants.DgvCellDataConvert2DicData(dgvVehicle, args, "v_model");
                };

                #region 车辆信息
                dgvVehicle.ReadOnly = false;
                dgvVehicle.Rows.Add(3);
                dgvVehicle.AllowUserToAddRows     = true;
                tb_vehicle_license_plate.ReadOnly = true;
                tb_vehicle_remark.ReadOnly        = true;
                tb_vehicle_v_brand.ReadOnly       = true;
                tb_vehicle_v_id.ReadOnly          = true;
                tb_vehicle_v_model.ReadOnly       = true;
                tb_vehicle_vin.ReadOnly           = true;

                dgvVehicle.CellClick += delegate(object sender, DataGridViewCellEventArgs args)
                {
                    if (args.ColumnIndex < 0)
                    {
                        return;
                    }
                    //if (dgvVehicle.Columns[args.ColumnIndex] != tb_vehicle_license_plate) return;
                    var chooser = new frmVehicleGrade();
                    var result  = chooser.ShowDialog();
                    if (result != DialogResult.OK)
                    {
                        return;
                    }
                    var strId = chooser.strLicensePlate;
                    var dpt   = DBHelper.GetTable("查询车辆档案信息", "tb_vehicle", "*", " license_plate='" + strId + "'", "", "");
                    if (dpt.Rows.Count <= 0)
                    {
                        return;
                    }
                    var dpr = dpt.Rows[0];
                    dgvVehicle.Rows[args.RowIndex].Cells["tb_vehicle_license_plate"].Value = CommonCtrl.IsNullToString(dpr["license_plate"]);
                    dgvVehicle.Rows[args.RowIndex].Cells["tb_vehicle_remark"].Value        = CommonCtrl.IsNullToString(dpr["remark"]);
                    dgvVehicle.Rows[args.RowIndex].Cells["tb_vehicle_v_brand"].Value       = CommonCtrl.IsNullToString(dpr["v_brand"]);
                    dgvVehicle.Rows[args.RowIndex].Cells["tb_vehicle_v_id"].Value          = CommonCtrl.IsNullToString(dpr["v_id"]);
                    dgvVehicle.Rows[args.RowIndex].Cells["tb_vehicle_v_model"].Value       = CommonCtrl.IsNullToString(dpr["v_model"]);
                    dgvVehicle.Rows[args.RowIndex].Cells["tb_vehicle_vin"].Value           = CommonCtrl.IsNullToString(dpr["vin"]);
                };
                #endregion

                #region 联系人信息
                dgvcontacts.CellFormatting += delegate(object sender, DataGridViewCellFormattingEventArgs args)
                {
                    UIAssistants.DgvCellDataConvert2DicData(dgvcontacts, args, "cont_post");
                    UIAssistants.DgvCellDataConvert2Datetime(dgvcontacts, args, "cont_birthday");
                };

                dgvcontacts.ReadOnly = false;
                dgvcontacts.Rows.Add(3);
                dgvcontacts.AllowUserToAddRows = true;
                cont_name.ReadOnly             = true;
                cont_post.ReadOnly             = true;
                cont_phone.ReadOnly            = true;
                cont_tel.ReadOnly      = true;
                cont_birthday.ReadOnly = true;
                cont_email.ReadOnly    = true;
                is_default.ReadOnly    = false;
                remark.ReadOnly        = true;

                dgvcontacts.CellContentClick += delegate(object sender, DataGridViewCellEventArgs e)
                {
                    if (e.RowIndex > -1 && e.ColumnIndex > -1)//双击表头或列头时不起作用
                    {
                        //获取控件的值
                        for (int i = 0; i < dgvcontacts.Rows.Count; i++)
                        {
                            dgvcontacts.Rows[i].Cells["is_default"].Value = "0";
                        }
                        dgvcontacts.Rows[e.RowIndex].Cells["is_default"].Value = "1";
                    }
                };

                dgvcontacts.CellClick += delegate(object sender, DataGridViewCellEventArgs args)
                {
                    if (args.ColumnIndex < 0 || args.RowIndex < 0)
                    {
                        return;
                    }
                    if (dgvcontacts.Columns[args.ColumnIndex] != cont_name)
                    {
                        return;
                    }
                    var frmPart = new frmContacts();
                    var result  = frmPart.ShowDialog();
                    if (result != DialogResult.OK)
                    {
                        return;
                    }
                    var strId = frmPart.contID;
                    var dpt   = DBHelper.GetTable("查询联系人信息", "v_contacts", string.Format("*,{0} phone ,{1} tel", EncryptByDB.GetDesFieldValue("cont_phone"), EncryptByDB.GetDesFieldValue("cont_tel")), " cont_id='" + strId + "'", "", "");
                    if (dpt.Rows.Count <= 0)
                    {
                        return;
                    }
                    var dpr = dpt.Rows[0];
                    dgvcontacts.Rows[args.RowIndex].Cells["cont_id"].Value       = CommonCtrl.IsNullToString(dpr["cont_id"]);
                    dgvcontacts.Rows[args.RowIndex].Cells["cont_name"].Value     = CommonCtrl.IsNullToString(dpr["cont_name"]);
                    dgvcontacts.Rows[args.RowIndex].Cells["cont_post"].Value     = CommonCtrl.IsNullToString(dpr["cont_post_name"]);
                    dgvcontacts.Rows[args.RowIndex].Cells["cont_phone"].Value    = CommonCtrl.IsNullToString(dpr["phone"]);
                    dgvcontacts.Rows[args.RowIndex].Cells["cont_tel"].Value      = CommonCtrl.IsNullToString(dpr["tel"]);
                    dgvcontacts.Rows[args.RowIndex].Cells["cont_birthday"].Value = CommonCtrl.IsNullToString(dpr["cont_birthday"]);
                    dgvcontacts.Rows[args.RowIndex].Cells["cont_email"].Value    = CommonCtrl.IsNullToString(dpr["cont_email"]);
                    dgvcontacts.Rows[args.RowIndex].Cells["is_default"].Value    = "0";
                    dgvcontacts.Rows[args.RowIndex].Cells["remark"].Value        = CommonCtrl.IsNullToString(dpr["remark"]);
                };
                #endregion
            }
            catch (Exception)
            {
            }
        }
예제 #12
0
        /// <summary>
        /// 根据车辆档案ID获取信息,复制和编辑用
        /// </summary>
        private void BindData()
        {
            #region 基础信息
            string    strWhere = string.Format("a.v_id='{0}'", strVId);
            string    strTable = "tb_vehicle a left join attachment_info b on b.relation_object='tb_vehicle' and is_main='1' and a.v_id = b.relation_object_id left join tb_vehicle_models c on a.v_model=c.vm_id";
            DataTable dt       = DBHelper.GetTable("查询车辆档案", strTable, "a.*,b.att_path,c.vm_name", strWhere, "", "");
            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }
            DataRow dr = dt.Rows[0];
            labCarNOS.Text    = CommonCtrl.IsNullToString(dr["license_plate"]);         //车牌号
            labCarBrandS.Text = GetDicName(CommonCtrl.IsNullToString(dr["v_brand"]));   //车辆品牌;
            labFactoryS.Text  = GetDicName(CommonCtrl.IsNullToString(dr["v_factory"])); //生产厂家
            labVINS.Text      = CommonCtrl.IsNullToString(dr["vin"]);                   //VIN
            labYardCodeS.Text = CommonCtrl.IsNullToString(dr["turner"]);                //车场编号
            labColorS.Text    = GetDicName(CommonCtrl.IsNullToString(dr["v_color"]));   //颜色
            labCarTypeS.Text  = CommonCtrl.IsNullToString(dr["vm_name"]);               //车型
            labRatingS.Text   = GetDicName(CommonCtrl.IsNullToString(dr["v_class"]));   //车辆等级
            labCustomNOS.Text = GetCustName(CommonCtrl.IsNullToString(dr["cust_id"]));  //所属客户
            if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["carbuy_date"])))
            {
                long Rticks = Convert.ToInt64(CommonCtrl.IsNullToString(dr["carbuy_date"]));
                labTimeS.Text = Common.UtcLongToLocalDateTime(Rticks).ToString(); //购车日期
            }
            labRemarkS.Text = CommonCtrl.IsNullToString(dr["remark"]);            //备注

            strStatus = CommonCtrl.IsNullToString(dr["status"]);                  //状态
            if (strStatus == Convert.ToInt32(DataSources.EnumStatus.Start).ToString())
            {
                base.btnStatus.Caption = "停用";
            }
            else if (strStatus == Convert.ToInt32(DataSources.EnumStatus.Stop).ToString())
            {
                base.btnStatus.Caption = "启用";
            }
            #endregion

            #region 车辆信息
            txtv_long.Caption           = CommonCtrl.IsNullToString(dr["v_long"]);           //车长
            txtv_wide.Caption           = CommonCtrl.IsNullToString(dr["v_wide"]);           //车宽
            txtv_high.Caption           = CommonCtrl.IsNullToString(dr["v_high"]);           //车高
            txtaxle_count.Caption       = CommonCtrl.IsNullToString(dr["axle_count"]);       //轴数
            txtaxle_distance.Caption    = CommonCtrl.IsNullToString(dr["axle_distance"]);    //轴距
            txtwheel_distance.Caption   = CommonCtrl.IsNullToString(dr["wheel_distance"]);   //轮距
            txttotal_quality.Caption    = CommonCtrl.IsNullToString(dr["total_quality"]);    //总质量
            txtapproved_quality.Caption = CommonCtrl.IsNullToString(dr["approved_quality"]); //核定质量
            txtengine_factory.Caption   = CommonCtrl.IsNullToString(dr["engine_factory"]);   //发动机厂家
            txtengine_model.Caption     = CommonCtrl.IsNullToString(dr["engine_model"]);     //发动机型号
            txtengine_num.Caption       = CommonCtrl.IsNullToString(dr["engine_num"]);       //发动机号
            txtdischarge.Caption        = CommonCtrl.IsNullToString(dr["discharge"]);        //排量
            txtfuel_type.Caption        = CommonCtrl.IsNullToString(dr["fuel_type"]);        //燃油类型
            txtair_factory.Caption      = CommonCtrl.IsNullToString(dr["air_factory"]);      //空调厂家
            txtair_model.Caption        = CommonCtrl.IsNullToString(dr["air_model"]);        //空调型号
            txtair_num.Caption          = CommonCtrl.IsNullToString(dr["air_num"]);          //空调编码
            txtaxle_factory.Caption     = CommonCtrl.IsNullToString(dr["axle_factory"]);     //车桥厂家
            txtaxle_model.Caption       = CommonCtrl.IsNullToString(dr["axle_model"]);       //车桥型号
            txtaxle_num.Caption         = CommonCtrl.IsNullToString(dr["axle_num"]);         //车桥编号
            txtlowdisc_factory.Caption  = CommonCtrl.IsNullToString(dr["lowdisc_factory"]);  //底盘厂家
            txtwheel_count.Caption      = CommonCtrl.IsNullToString(dr["wheel_count"]);      //轮胎数
            txtwheel_factory.Caption    = CommonCtrl.IsNullToString(dr["wheel_factory"]);    //轮胎厂家
            txtwheel_model.Caption      = CommonCtrl.IsNullToString(dr["wheel_model"]);      //轮胎型号
            txtshift_factory.Caption    = CommonCtrl.IsNullToString(dr["shift_factory"]);    //变速箱厂家
            txtshift_model.Caption      = CommonCtrl.IsNullToString(dr["shift_model"]);      //变速箱型号
            txtshift_num.Caption        = CommonCtrl.IsNullToString(dr["shift_num"]);        //变速箱号
            txtshift_type.Caption       = CommonCtrl.IsNullToString(dr["shift_type"]);       //变速箱类型
            txtgps_factory.Caption      = CommonCtrl.IsNullToString(dr["gps_factory"]);      //GPS厂家
            txtgps_model.Caption        = CommonCtrl.IsNullToString(dr["gps_model"]);        //GPS型号
            txtgps_num.Caption          = CommonCtrl.IsNullToString(dr["gps_num"]);          //GPS编号
            txtdvr_factory.Caption      = CommonCtrl.IsNullToString(dr["dvr_factory"]);      //DVR厂家
            txtdvr_model.Caption        = CommonCtrl.IsNullToString(dr["dvr_model"]);        //DVR型号
            txtdvr_num.Caption          = CommonCtrl.IsNullToString(dr["dvr_num"]);          //DVR编号
            string photoPath = CommonCtrl.IsNullToString(dr["att_path"]);
            picPhoto.BackgroundImage = FileOperation.DownLoadImage(photoPath);               //图片信息
            picPhoto.ImageLocation   = photoPath;

            string strSource = CommonCtrl.IsNullToString(dr["data_source"]);
            if (strSource == Convert.ToInt32(DataSources.EnumDataSources.YUTONG).ToString())
            {
                btnEdit.Enabled    = false;
                tsmiEdit.Enabled   = false;
                btnDelete.Enabled  = false;
                tsmiDelete.Enabled = false;
            }
            else
            {
                btnEdit.Enabled    = true;
                tsmiEdit.Enabled   = true;
                btnDelete.Enabled  = true;
                tsmiDelete.Enabled = true;
            }
            #endregion

            #region 底部datagridview数据

            #region 驾驶员信息
            //驾驶员信息
            DataTable dpt = DBHelper.GetTable("驾驶员信息", "tr_driver_vehicle", "*", string.Format(" v_id='{0}'", strVId), "", "");
            if (dpt.Rows.Count > 0)
            {
                string strConId = string.Empty;
                for (int i = 0; i < dpt.Rows.Count; i++)
                {
                    DataRow dur = dpt.Rows[i];
                    strConId += "'" + CommonCtrl.IsNullToString(dur["driver_id"]) + "'" + ",";
                }
                strConId = strConId.Substring(0, strConId.Length - 1);
                if (!string.IsNullOrEmpty(strConId))
                {
                    DataTable dut = DBHelper.GetTable("联系人信息", "tb_contacts", string.Format("*,{0} phone, {1} tel", EncryptByDB.GetDesFieldValue("cont_phone"), EncryptByDB.GetDesFieldValue("cont_tel")), "cont_id in (" + strConId + ")", "", "order by cont_id desc");
                    if (dut.Rows.Count > dgvUser.Rows.Count)
                    {
                        dgvUser.Rows.Add(dut.Rows.Count - dgvUser.Rows.Count + 1);
                    }
                    for (int j = 0; j < dut.Rows.Count; j++)
                    {
                        DataRow dpr = dut.Rows[j];
                        dgvUser.Rows[j].Cells["cont_name"].Value     = CommonCtrl.IsNullToString(dpr["cont_name"]);
                        dgvUser.Rows[j].Cells["cont_post"].Value     = GetDicName(CommonCtrl.IsNullToString(dpr["cont_post"]));
                        dgvUser.Rows[j].Cells["cont_phone"].Value    = CommonCtrl.IsNullToString(dpr["phone"]);
                        dgvUser.Rows[j].Cells["cont_tel"].Value      = CommonCtrl.IsNullToString(dpr["tel"]);
                        dgvUser.Rows[j].Cells["cont_email"].Value    = CommonCtrl.IsNullToString(dpr["cont_email"]);
                        dgvUser.Rows[j].Cells["cont_birthday"].Value = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dpr["cont_birthday"])) ? Common.UtcLongToLocalDateTime(Convert.ToInt64(CommonCtrl.IsNullToString(dpr["cont_birthday"]))).ToString() : "";
                        dgvUser.Rows[j].Cells["remark"].Value        = CommonCtrl.IsNullToString(dpr["remark"]);
                        dgvUser.Rows[j].Cells["cont_id"].Value       = CommonCtrl.IsNullToString(dpr["cont_id"]);
                        DataRow dur = dpt.Rows[j];
                        dgvUser.Rows[j].Cells["dir_v_id"].Value = CommonCtrl.IsNullToString(dur["dir_v_id"]);
                        string strDefault = CommonCtrl.IsNullToString(dur["isDefault"]);
                        if (!string.IsNullOrEmpty(strDefault))
                        {
                            dgvUser.Rows[j].Cells[isDefault.Name].Value = strDefault == "1" ? true : false;
                        }
                    }
                }
            }
            #endregion
            //附件信息数据
            ucAttr.TableName         = "tb_vehicle";
            ucAttr.TableNameKeyValue = strVId;
            ucAttr.BindAttachment();

            #endregion
        }
예제 #13
0
        /// <summary>
        /// 设置速查
        /// </summary>
        /// <param name="sqlString"></param>
        void tc_GetDataSourced(TextChooser tc, string sqlString)
        {
            if (sqlString.Contains("v_vehicle"))
            {
                string fileds = string.Format(" license_plate,vin,engine_num,v_model,v_brand,v_color,turner,cust_code,cust_id,cust_name,cont_name,{0} phone ", EncryptByDB.GetDesFieldValue("cont_phone"));
                sqlString = sqlString.Replace("*", fileds);
            }
            DataTable dvt = CommonFuncCall.GetDataSource(sqlString);

            tc.SetDataSource(dvt);
            if (dvt != null)
            {
                tc.Search();
            }
        }
예제 #14
0
        /// <summary>
        /// 获取该供应商下所关联的所有联系人信息
        /// </summary>
        /// <param name="suppId"></param>
        /// <returns></returns>
        private void GetAllContacts(string suppId)
        {
            //string conId = string.Empty;
            //DataTable dt_contacts = new DataTable();
            //DataTable dt_base_contacts = DBHelper.GetTable("查询关联的联系人ID集合", "tr_base_contacts", "cont_id", " relation_object_id='" + suppId + "'", "", "");
            //if (dt_base_contacts != null && dt_base_contacts.Rows.Count > 0)
            //{
            //    foreach (DataRow dr in dt_base_contacts.Rows)
            //    {
            //        conId += "'" + dr["cont_id"] + "',";
            //    }
            //    conId = conId.Trim(',');
            //    gvUserInfoList.DataSource = DBHelper.GetTable("查询关联的联系人信息", "tb_contacts", "*", " cont_id in (" + conId + ")", "", "");
            //}
            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();
                    }
                }
            }
        }
예제 #15
0
        private void SetCustInfo()  //设置客户信息
        {
            if (String.IsNullOrEmpty(CustId))
            {
                return;
            }
            var custInfo = DBHelper.GetTable("查询客户信息", "tb_customer", string.Format("*,{0} phone", EncryptByDB.GetDesFieldValue("cust_phone")), "cust_id = '" + CustId + "'", "",
                                             "");

            if (custInfo != null && custInfo.DefaultView.Count != 0)
            {
                txt_cust_code.Text          = custInfo.DefaultView[0]["cust_code"].ToString();
                txt_cust_code.Tag           = CustId;
                txt_cust_name.Text          = custInfo.DefaultView[0]["cust_name"].ToString();
                txt_legal_person.Caption    = custInfo.DefaultView[0]["legal_person"].ToString();
                cbo_cust_type.SelectedValue = custInfo.DefaultView[0]["cust_type"].ToString();
                txt_cust_short_name.Caption = custInfo.DefaultView[0]["cust_short_name"].ToString();
                txt_cust_quick_code.Caption = custInfo.DefaultView[0]["cust_quick_code"].ToString();
                cbo_province.Text           = custInfo.DefaultView[0]["province"].ToString();
                cbo_city.Text             = custInfo.DefaultView[0]["city"].ToString();
                txt_cust_fax.Caption      = custInfo.DefaultView[0]["cust_fax"].ToString();
                cbo_county.Text           = custInfo.DefaultView[0]["county"].ToString();
                txt_cust_address.Caption  = custInfo.DefaultView[0]["cust_address"].ToString();
                txt_cust_phone.Caption    = custInfo.DefaultView[0]["phone"].ToString();
                txt_cust_email.Caption    = custInfo.DefaultView[0]["cust_email"].ToString();
                chk_is_member.Checked     = custInfo.DefaultView[0]["is_member"].ToString() == "1";
                txt_member_number.Caption = custInfo.DefaultView[0]["member_number"].ToString();
                cbo_member_class.Text     = custInfo.DefaultView[0]["member_class"].ToString();

                if (custInfo.DefaultView[0]["member_period_validity"] != DBNull.Value)
                {
                    var ticks = (long)custInfo.DefaultView[0]["member_period_validity"];
                    dtp_member_period_validity.Value = Common.UtcLongToLocalDateTime(ticks);
                }
            }
        }
예제 #16
0
        //绑定数据
        private void BindData()
        {
            string    strWhere = string.Format("cont_id='{0}'", contID);
            DataTable dt       = DBHelper.GetTable("查询联系人", "tb_contacts", string.Format("*,{0} phone", EncryptByDB.GetDesFieldValue("cont_phone")), strWhere, "", "");

            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }
            DataRow dr = dt.Rows[0];

            txtContEmail.Caption      = CommonCtrl.IsNullToString(dr["cont_email"]);
            txtContName.Caption       = CommonCtrl.IsNullToString(dr["cont_name"]);
            txtContPhone.Caption      = CommonCtrl.IsNullToString(dr["phone"]);
            txtContTel.Caption        = CommonCtrl.IsNullToString(dr["cont_tel"]);
            txtRemark.Caption         = CommonCtrl.IsNullToString(dr["remark"]);
            cboContPost.SelectedValue = CommonCtrl.IsNullToString(dr["cont_post"]);
            cboNation.SelectedValue   = dr["nation"];
            //chkIsDefault.Checked = CommonCtrl.IsNullToString(dr["is_default"]) == "1";
            string sex = CommonCtrl.IsNullToString(dr["sex"]);

            rbMan.Checked   = sex == "1";
            rbWoman.Checked = sex == "0";
        }
예제 #17
0
        private void SetContInfo() //设置反馈人信息
        {
            var custInfo = DBHelper.GetTable("查询联系人信息", "tb_contacts", string.Format("*,{0} phone", EncryptByDB.GetDesFieldValue("cont_phone")), "cont_id = '" + ContId + "'", "", "");

            if (custInfo != null && custInfo.DefaultView.Count != 0)
            {
                txt_cb_Callback_by.Text          = custInfo.DefaultView[0]["cont_name"].ToString();
                txt_cb_Callback_by.Tag           = ContId;
                txt_cb_Callback_by_phone.Caption = custInfo.DefaultView[0]["phone"].ToString();
            }
        }
예제 #18
0
        //绑定联系人数据
        private void BinddgvContacts()
        {
            StringBuilder sbWhere = new StringBuilder();

            sbWhere.Append("enable_flag='1' and status='1' "); //未删除标识
            string name = txtName.Caption.Trim();              //姓名

            if (name.Length > 0)
            {
                sbWhere.AppendFormat(" and cont_name like '%{0}%'", name);
            }
            string sex = CommonCtrl.IsNullToString(cboSex.SelectedValue);//性别

            if (sex.Length > 0)
            {
                sbWhere.AppendFormat(" and sex='{0}'", sex);
            }

            string tel = txtTel.Caption.Trim();//电话

            if (tel.Length > 0)
            {
                //sbWhere.AppendFormat(" and cont_tel like '%{0}%'", tel);
                //string dianhua = tel.Caption.Trim();//电话
                if (tel.Length > 0)
                {
                    //sbWhere.AppendFormat(" and (cont_phone like '%{0}%' or cont_tel like '%{0}%')", dianhua);
                    sbWhere.AppendFormat(" and ({1} like '%{0}%' or {2} like '%{0}%')", tel, EncryptByDB.GetDesFieldValue("cont_phone"), EncryptByDB.GetDesFieldValue("cont_tel"));
                }
            }
            if (cbo_data_source.SelectedValue != null && !String.IsNullOrEmpty(cbo_data_source.SelectedValue.ToString()))
            {
                sbWhere.AppendFormat(" and data_source = '{0}'", cbo_data_source.SelectedValue);
            }
            //DataTable dt = DBHelper.GetTable("联系人查询", "v_contacts", string.Format("*,{0} phone", EncryptByDB.GetDesFieldValue("cont_phone")), sbWhere.ToString(), "", "order by cont_name");
            int       recordCount = 0;
            DataTable dt          = DBHelper.GetTableByPage("联系人查询", "v_contacts", string.Format("*,{0} phone, {1} tel", EncryptByDB.GetDesFieldValue("cont_phone"), EncryptByDB.GetDesFieldValue("cont_tel")), sbWhere.ToString(), "", "order by cont_name", page.PageIndex, page.PageSize, out recordCount);

            dgvContacts.RowCount = 0;
            foreach (DataRow dr in dt.Rows)
            {
                DataGridViewRow dgvr = dgvContacts.Rows[dgvContacts.Rows.Add()];
                dgvr.Cells["colContID"].Value         = dr["cont_id"];
                dgvr.Cells["colContName"].Value       = dr["cont_name"];
                dgvr.Cells["colSex"].Value            = dr["sex"];
                dgvr.Cells["colContPost"].Value       = dr["cont_post_name"];
                dgvr.Cells["colNation"].Value         = dr["nation_name"];
                dgvr.Cells["colContPhone"].Value      = dr["phone"];
                dgvr.Cells["colContTel"].Value        = dr["tel"];
                dgvr.Cells["col_cont_crm_guid"].Value = dr["cont_crm_guid"];

                //string createTime = CommonCtrl.IsNullToString(dr["create_time"]);
                if (CommonCtrl.IsNullToString(dr["create_time"]) != null)
                {
                    //dgvr.Cells["colCreateTime"].Value = DateTime.MinValue.AddTicks(Convert.ToInt64(createTime)).ToLocalTime();
                    dgvr.Cells["colCreateTime"].Value = Common.UtcLongToLocalDateTime(CommonCtrl.IsNullToString(dr["create_time"]));
                }
            }
            page.RecordCount = recordCount;
        }
예제 #19
0
        //保存
        private bool Save()
        {
            Dictionary <string, ParamObj> dic     = new Dictionary <string, ParamObj>();
            List <SysSQLString>           listSql = new List <SysSQLString>();
            //List<SQLObj> listSql = new List<SQLObj>();
            SysSQLString sysSql = new SysSQLString();

            //SQLObj obj = new SQLObj();
            sysSql.cmdType = CommandType.Text;
            sysSql.Param   = new Dictionary <string, string>();
            //obj.cmdType = CommandType.Text;
            //obj.Param = new Dictionary<string, ParamObj>();
            string cont_id = Guid.NewGuid().ToString();

            //obj.Param.Add("cont_id", new ParamObj("cont_id", cont_id.ToString(), SysDbType.VarChar));//cont_id
            //obj.Param.Add("cont_name", new ParamObj("cont_name", txtContName.Caption, SysDbType.VarChar));//cont_name
            //obj.Param.Add("enable_flag", new ParamObj("enable_flag", (int)DataSources.EnumEnableFlag.USING, SysDbType.Int));//enable_flag
            //obj.Param.Add("data_source", new ParamObj("data_source", (int)DataSources.EnumDataSources.SELFBUILD, SysDbType.Int));//data_source
            //obj.Param.Add("status", new ParamObj("status", (int)DataSources.EnumStatus.Start, SysDbType.Int, 5));//status
            //obj.Param.Add("create_by", new ParamObj("create_by", GlobalStaticObj.UserID, SysDbType.VarChar));//create_by
            //obj.Param.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(DateTime.Now), SysDbType.DateTime));//create_time

            sysSql.sqlString = string.Format(@"INSERT INTO [tb_contacts]
                        ([cont_id]
                        ,[cont_name]       
                        ,[cont_tel]
                        ,[enable_flag]
                        ,[data_source]
                        ,[status]
                        ,[create_by]
                        ,[create_time]
                        ,[cont_phone])
                        VALUES
                        ('{0}','{1}',{2},'{3}','{4}','{5}','{6}','{7}',{8})",
                                             cont_id.ToString(),                                  //cont_id
                                             txtContName.Caption,                                 //cont_name
                                             EncryptByDB.GetEncFieldValue(txtContTel.Caption),    //cont_tel
                                             (int)DataSources.EnumEnableFlag.USING,               //enable_flag
                                             (int)DataSources.EnumDataSources.SELFBUILD,          //data_source
                                             (int)DataSources.EnumStatus.Start,                   //status
                                             GlobalStaticObj.UserID,                              //create_by
                                             Common.LocalDateTimeToUtcLong(DateTime.Now),         //create_time
                                             EncryptByDB.GetEncFieldValue(txtContPhone.Caption)); //cont_phone
            //            obj.sqlString = string.Format(@"INSERT INTO [tb_contacts]
            //            ([cont_id]
            //            ,[cont_name]
            //            ,[cont_tel]
            //            ,[enable_flag]
            //            ,[data_source]
            //            ,[status]
            //            ,[create_by]
            //            ,[create_time]
            //            ,[cont_phone])
            //            VALUES
            //            (@cont_id,@cont_name,{0},@enable_flag,@data_source,@status,@create_by,@create_time,{1})",
            //            EncryptByDB.GetEncFieldValue(txtContTel.Caption),//cont_tel
            //            EncryptByDB.GetEncFieldValue(txtContPhone.Caption));//cont_phone

            //listSql.Add(obj);
            listSql.Add(sysSql);
            if (DBHelper.BatchExeSQLStringMultiByTrans("新增联系人", listSql))
            {
                ContactsInfo continfo = new ContactsInfo();
                continfo.contDuty  = string.Empty;
                continfo.contID    = cont_id;
                continfo.contName  = txtContName.Caption;
                continfo.contPhone = txtContTel.Caption;
                continfo.crmId     = string.Empty;
                //保存成功后触发保存事件
                if (SaveEvent != null)
                {
                    SaveEvent.BeginInvoke(continfo, null, null);
                }
                MessageBoxEx.Show("保存成功!");
                return(true);
            }
            else
            {
                MessageBoxEx.Show("保存失败!");
                return(false);
            }
        }