Example #1
0
        /// <summary>
        /// 查重方法
        /// </summary>
        /// <returns></returns>
        private bool btnCheck()
        {
            bool rbool = true;

            try
            {
                string name = this.txtCustomerInfo_Name.Text;
                //判断名称是否已存在
                Expression <Func <CustomerInfo, bool> > funviewCustomerInfo1 = n => n.CustomerInfo_Name == name && n.CustomerInfo_Name != this.dgvCustomerInfo.SelectedRows[0].Cells["CustomerInfo_Name"].Value.ToString();
                if (CustomerInfoDAL.Query(funviewCustomerInfo1).Count() > 0)
                {
                    PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "该公司名称已存在已存在", txtCustomerInfo_Name, this);
                    txtCustomerInfo_Name.Focus();
                    rbool = false;
                }
                return(rbool);
            }
            catch
            {
                CommonalityEntity.WriteTextLog("人员信息管理 btnCheck()");
                rbool = false;
            }
            return(rbool);
        }
Example #2
0
        /// <summary>
        /// 双击组件时发生
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvCustomerInfo_DoubleClick(object sender, EventArgs e)
        {
            this.btnUpdate.Enabled = true;
            this.btnSave.Enabled   = false;
            if (this.dgvCustomerInfo.SelectedRows.Count > 0)//选中行
            {
                if (dgvCustomerInfo.SelectedRows.Count > 1)
                {
                    MessageBox.Show("修改只能选中一行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    btnDel.Enabled = true;
                    //修改的值
                    int ID = int.Parse(this.dgvCustomerInfo.SelectedRows[0].Cells["CustomerInfo_ID"].Value.ToString());
                    Expression <Func <CustomerInfo, bool> > funviewinto = n => n.CustomerInfo_ID == ID;
                    foreach (var n in CustomerInfoDAL.Query(funviewinto))
                    {
                        if (n.CustomerInfo_Name != null)
                        {
                            //公司名称
                            this.txtCustomerInfo_Name.Text = n.CustomerInfo_Name;
                        }
                        if (n.CustomerInfo_State != null)
                        {
                            // 公司状态
                            this.comboxCustomerInfo_State.Text = n.CustomerInfo_State;
                        }
                        if (n.CustomerInfo_Type != null)
                        {
                            // 公司电话
                            this.txtCustomerInfo_Type.Text = n.CustomerInfo_Type;
                        }
                        if (n.CustomerInfo_Email != null)
                        {
                            // 公司业务描述
                            this.txtCustomerInfo_Email.Text = n.CustomerInfo_Email;
                        }
                        if (n.CustomerInfo_Contact != null)
                        {
                            // 公司联系人
                            this.txtCustomerInfo_Contact.Text = n.CustomerInfo_Contact;
                        }
                        if (n.CustomerInfo_ADD != null)
                        {
                            // 公司地址
                            this.txtCustomerInfo_ADD.Text = n.CustomerInfo_ADD;
                        }
                        if (n.CustomerInfo_Remark != null)
                        {
                            // 公司备注
                            this.txtCustomerInfo_Remark.Text = n.CustomerInfo_Remark;
                        }

                        break;
                    }
                }
            }
            else
            {
                MessageBox.Show("请选择要修改的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }