Beispiel #1
0
        public FormCallRecords(int companyid, bool isControlRole) : this()
        {
            Add();

            this._isControlRole = isControlRole;

            FishBll.Bll.CompanyBll   bll   = new FishBll.Bll.CompanyBll();
            FishEntity.CompanyEntity model = bll.GetModel(companyid);
            SetCompanyData(model);
        }
Beispiel #2
0
        protected void SetCustomer()
        {
            txtCode.Text         = _customer.code;
            txtName.Text         = _customer.name;
            dtpCurrentDate.Value = _customer.currentlinkDate.Value;
            txtTelephone.Text    = _customer.telephone;
            txtPhone1.Text       = _customer.phone1;
            txtPhone2.Text       = _customer.phone2;
            txtPhone3.Text       = _customer.phone3;
            txtPost.Text         = _customer.post;
            txtdepartment1.Text  = Customer.Department1;
            txtEmail.Text        = _customer.email;
            txtQQ.Text           = _customer.qq;
            cmbValidate.Text     = _customer.validate == 1 ? "有效" : "无效";
            txtWeixin.Text       = _customer.weixin;
            txtRemark.Text       = _customer.remark;
            if (_customer.nextlinkdate != null)
            {
                txtNextLinkDate.Text = _customer.nextlinkdate.Value.ToString("yyyy-MM-dd");
            }
            else
            {
                txtNextLinkDate.Text = string.Empty;
            }
            FishBll.Bll.CompanyBll bll = new FishBll.Bll.CompanyBll();
            if (string.IsNullOrEmpty(_customer.company) == false)
            {
                FishEntity.CompanyEntity company = bll.GetModelByCode(_customer.company);
                if (company != null)
                {
                    _customer.companyId = company.id;
                    txtCompany.Text     = company.fullname;
                    txtCompany.Tag      = company;
                    txtCompanyCode.Text = company.code;
                }
            }
            else
            {
                txtCompany.Tag      = null;
                txtCompany.Text     = string.Empty;
                txtCompanyCode.Text = string.Empty;
            }

            txtHomeAddress.Text   = _customer.homeaddress;
            txtOfficeAddress.Text = _customer.officeaddress;
            rdbMan.Checked        = _customer.sex.Equals("男");
            rdbWoman.Checked      = _customer.sex.Equals("女");

            pictureBox1.Image = GetHeadPicture(_customer.id);

            txtfox.Text = _customer.fox;
        }
Beispiel #3
0
        protected void SetCompanyData(FishEntity.CompanyEntity company)
        {
            if (company == null)
            {
                return;
            }

            txtCompanyName.Text = company.fullname;
            txtCompanyCode.Text = company.code;
            txtCompanyCode.Tag  = company.id;
            txtLevel.Text       = company.generallevel;
            txtAddress.Text     = company.address;

            txtLinkMan.Text     = string.Empty;
            txtLinkManCode.Text = string.Empty;

            txtCustomerNature.Text = company.customerproperty;
            txtSaleman.Text        = company.salesman;
            txttransportfee.Text   = company.freight.ToString();
            txtweight.Text         = company.tare.ToString();
            txtspecifacation.Text  = company.requiredproduct;
            txtQuality.Text        = company.productrequire;
            txtProducts.Text       = company.products;
            txtcompetitors.Text    = company.competitors;
            txtWeek.Text           = company.currentweekestimate.ToString();
            txtMonth.Text          = company.currentmonthestimate.ToString();

            FishBll.Bll.CustomerBll          customerBll = new FishBll.Bll.CustomerBll();
            List <FishEntity.CustomerEntity> customers   = customerBll.GetCustomerOfCompany(company.id);

            if (customers != null && customers.Count > 0)
            {
                FishEntity.CustomerEntity customer = customers.Find((i) => { return(i.flag == 1); });
                if (customer != null)
                {
                    txtLinkMan.Text     = customer.name;
                    txtLinkManCode.Text = customer.code;
                    txtLinkMan.Tag      = customer.id;
                    string phone = string.IsNullOrEmpty(customer.phone1) ? "" : customer.phone1;
                    if (!string.IsNullOrEmpty(customer.phone2))
                    {
                        phone += string.IsNullOrEmpty(phone) ? customer.phone2 : " , " + customer.phone2;
                    }
                    if (!string.IsNullOrEmpty(customer.phone3))
                    {
                        phone += string.IsNullOrEmpty(phone) ? customer.phone3 : " , " + customer.phone3;
                    }
                    txtMobile.Text    = phone;
                    txtOfficeTel.Text = customer.telephone;
                }
            }
        }
Beispiel #4
0
        public List <FishEntity.CompanyEntity> Reports(string where)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from t_company ");
            if (false == string.IsNullOrEmpty(where))
            {
                strSql.Append(" where  " + where);
            }
            DataSet ds       = MySqlHelper.Query(strSql.ToString());
            int     rowcount = ds.Tables[0].Rows.Count;
            List <FishEntity.CompanyEntity> list = new List <FishEntity.CompanyEntity>();

            for (int i = 0; i < rowcount; i++)
            {
                FishEntity.CompanyEntity model = new FishEntity.CompanyEntity();
                DataRow row = ds.Tables[0].Rows[i];
                model = CompanyDao.DataRowToModel(row);
                list.Add(model);
            }
            return(list);
        }
Beispiel #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public FishEntity.CompanyEntity GetModelByCode(string code)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,code,type,fullname,shortname,generallevel,creditlevel,requiredlevel,managestandard,activelevel,loyalty,products,salesmancode,salesman,area,address,nature,manageprojects,registermoney,registertime,personnumber,zipcode,fox,website,linkmancode,linkman,currentlink,currentweekestimate,currentmonthestimate,nextlinkdate,description,validate,modifyman,modifytime,createman,createtime,isdelete,fatures,bank,account,threecard,type_customer,type_suppliers,type_quote,type_merchants,type_goods,type_agents,estimatepurchasetime,customerproperty,customergroup,cashdeposit,paymethod,competitors,requiredproduct,registerman,cooperation,province,zone,productrequire,freight,tare,yearSale,productgoods,yearproduct,supportproduct,yearsupport,cashdate,cashmethod,agentfeerate,issuingfeerate,billperiod,passfeerate,storagefee1,storagefee2,storagefee3,storagefee4,storagefee5,freight1,freight2,freight3,freight4,freight5,freight6,storageday1,storageday2,storageday3,storageday4,storageday5,paydays,requiregoods from t_company ");
            strSql.Append(" where code=@code");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@code", MySqlDbType.VarChar, 45)
            };
            parameters[0].Value = code;

            FishEntity.CompanyEntity model = new FishEntity.CompanyEntity();
            DataSet ds = MySqlHelper.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel1(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #6
0
        public override void Save()
        {
            FishEntity.OnepoundEntity _fish = new FishEntity.OnepoundEntity();
            _fish.Buyers = Buyers.Text;
            if (string.IsNullOrEmpty(Sellers.Text) == false)
            {
                FishEntity.CompanyEntity company = Sellers.Tag as FishEntity.CompanyEntity;
                _fish.Sellers = Sellers.Text.ToString();
            }
            else
            {
                MessageBox.Show("请选择销售商。");
                return;
            }
            if (string.IsNullOrEmpty(txtCodeOdd.Text))
            {
                MessageBox.Show("请选择销售合同号");
                return;
            }
            if (GetValue() == false)
            {
                return;
            }
            decimal temp = 0;

            _fish.Code               = FishBll.Bll.SequenceUtil.GerLadingNumber();
            _fish.OwnerId            = txtOwner.Tag.ToString();
            _fish.BuyersId           = Buyers.Tag.ToString();
            _fish.SellersId          = Sellers.Tag.ToString();
            _fish.Dateofmanufacture  = dtpfactureDate.Value;
            _fish.IntothefactoryDate = dtpfactoryDate.Value;
            _fish.Carnumber          = txtCarnumber.Text.Trim();
            _fish.Goods              = cmbspecies.SelectedValue == null ? string.Empty : cmbspecies.SelectedValue.ToString();
            _fish.Remarks            = txtRemarks.Text;
            _fish.Shipno             = txtshipno.Text;
            _fish.Grossweight        = txtGrossweight.Text;
            _fish.Tareweight         = txtTareweight.Text;
            _fish.Competition        = txtCompetition.Text;
            _fish.Owner              = txtOwner.Text.Trim();
            _fish.Quantity           = Quantity.Text.Trim();
            _fish.Pileangle          = Pileangle.Text.Trim();
            _fish.BillOfLadingid     = BillOfLadingid.Text.Trim();
            _fish.PName              = cmbName.SelectedValue == null ? string.Empty : cmbName.SelectedValue.ToString();
            _fish.Country            = cmbCountry.SelectedValue == null ? string.Empty : cmbCountry.SelectedValue.ToString();
            _fish.Qualit             = txtSpecification.Text;
            _fish.Serialnumber       = Serialnumber.Text.Trim();
            _fish.Address            = txtAddress.Text.Trim();
            _fish.Createtime         = DateTime.Now;
            _fish.Createman          = FishEntity.Variable.User.username;
            _fish.Modifytime         = DateTime.Now;
            _fish.Modifyman          = _fish.Createman;
            _fish.codeContract       = txtCodeOdd.Text;
            _fish.Numbering          = txtNumbering.Text;

            FishBll.Bll.OnepoundBll bll = new FishBll.Bll.OnepoundBll();

            bool isok = bll.Exists(_fish.Code);

            while (isok)
            {
                _fish.Code = FishBll.Bll.SequenceUtil.GerLadingNumber();
                isok       = bll.Exists(_fish.Code);
            }
            int id = bll.Add(_fish);

            if (id > 0)
            {
                if (txtNumbering.Text != "")
                {
                    _Refreshbll = new FishBll.Bll.ProcessStateBll();
                    _Refreshbll.GetFormOnepound(txtNumbering.Text);
                }
                _fish.Id = id;
                AddImages(_fish);
                tmiQuery.Visible  = false;
                tmiDelete.Visible = false;
                tmiModify.Visible = false;
                tmiAdd.Visible    = true;
                tmiSave.Visible   = false;
                tmiCancel.Visible = true;
                MessageBox.Show("添加成功。");
                txtCode.Text = _fish.Code.ToString();
            }
            else
            {
                // txtCode.Text = _fish.Code;
                MessageBox.Show("添加失败。");
            }
        }
Beispiel #7
0
        public override int Modify()
        {
            if (Check() == false)
            {
                return(0);
            }

            int sourceCompanyId = _customer.companyId;

            _customer.code = txtCode.Text;
            int companyId = 0;

            if (string.IsNullOrEmpty(txtCompany.Text) == false && txtCompany.Tag != null && txtCompany.Tag is FishEntity.CompanyEntity)
            {
                FishEntity.CompanyEntity company = txtCompany.Tag as FishEntity.CompanyEntity;
                _customer.company   = company.code;
                companyId           = company.id;
                _customer.companyId = company.id;
            }
            else
            {
                _customer.companyId = 0;
                _customer.company   = string.Empty;
            }

            _customer.currentlinkDate = dtpCurrentDate.Value;
            _customer.department      = string.Empty;
            _customer.email           = txtEmail.Text;
            _customer.modifyman       = FishEntity.Variable.User.username;
            _customer.modifytime      = DateTime.Now;
            _customer.name            = txtName.Text;
            _customer.phone1          = txtPhone1.Text;
            _customer.phone2          = txtPhone2.Text;
            _customer.phone3          = txtPhone3.Text;
            _customer.post            = txtPost.Text;
            _customer.Department1     = txtdepartment1.Text;
            _customer.qq        = txtQQ.Text;
            _customer.remark    = txtRemark.Text;
            _customer.telephone = txtTelephone.Text;
            _customer.validate  = cmbValidate.Text.Equals("有效")?1:0;
            _customer.weixin    = txtWeixin.Text;

            _customer.homeaddress   = txtHomeAddress.Text.Trim();
            _customer.officeaddress = txtOfficeAddress.Text.Trim();
            _customer.sex           = rdbMan.Checked?"男":"女";
            _customer.fox           = txtfox.Text.Trim();

            DateTime nextlinkDate;

            if (DateTime.TryParse(txtNextLinkDate.Text, out nextlinkDate))
            {
                _customer.nextlinkdate = nextlinkDate;
            }
            else
            {
                _customer.nextlinkdate = null;
            }

            FishBll.Bll.CustomerBll bll = new FishBll.Bll.CustomerBll();
            bool isOk = bll.Update(_customer);

            if (isOk)
            {
                FishBll.Bll.CustomerOfCompanyBll ccBll = new FishBll.Bll.CustomerOfCompanyBll();
                if (_customer.companyId == 0 && sourceCompanyId > 0)
                {
                    ccBll.Delete(sourceCompanyId, _customer.id);
                }
                else if (_customer.companyId > 0 && sourceCompanyId == 0)
                {
                    FishEntity.CustomerOfCompanyEntity ccEntity = new FishEntity.CustomerOfCompanyEntity();
                    ccEntity.companyid  = _customer.companyId;
                    ccEntity.customerid = _customer.id;
                    ccBll.Add(ccEntity);
                }
                else if (_customer.companyId > 0 && sourceCompanyId > 0)
                {
                    ccBll.Update(sourceCompanyId, _customer.id, _customer.companyId, _customer.id);
                }

                SaveHeaderPicture(_customer.id);

                MessageBox.Show("修改成功。");
            }
            else
            {
                MessageBox.Show("修改失败。");
            }

            return(1);
        }
Beispiel #8
0
        public override void Save()
        {
            if (Check() == false)
            {
                return;
            }
            _customer      = new FishEntity.CustomerEntity();
            _customer.code = FishBll.Bll.SequenceUtil.GetCustomerSequence();
            int companyId = 0;

            if (string.IsNullOrEmpty(txtCompany.Text) == false && txtCompany.Tag != null && txtCompany.Tag is FishEntity.CompanyEntity)
            {
                FishEntity.CompanyEntity company = txtCompany.Tag as FishEntity.CompanyEntity;
                _customer.company   = company.code;
                companyId           = company.id;
                _customer.companyId = company.id;
            }
            _customer.createman       = FishEntity.Variable.User.username;
            _customer.createtime      = DateTime.Now;
            _customer.currentlinkDate = dtpCurrentDate.Value;
            _customer.department      = string.Empty;
            _customer.email           = txtEmail.Text;
            _customer.isdelete        = 0;
            _customer.modifyman       = _customer.createman;
            _customer.modifytime      = _customer.createtime;
            _customer.name            = txtName.Text;

            DateTime nextlinkdate;

            if (DateTime.TryParse(txtNextLinkDate.Text, out nextlinkdate))
            {
                _customer.nextlinkdate = DateTime.Parse(txtNextLinkDate.Text);
            }
            else
            {
                _customer.nextlinkdate = null;
            }

            _customer.phone1      = txtPhone1.Text;
            _customer.phone2      = txtPhone2.Text;
            _customer.phone3      = txtPhone3.Text;
            _customer.post        = txtPost.Text;
            _customer.Department1 = txtdepartment1.Text;
            _customer.qq          = txtQQ.Text;
            _customer.remark      = txtRemark.Text;
            _customer.telephone   = txtTelephone.Text;
            _customer.validate    = cmbValidate.Text.Equals("有效") ? 1 : 0;
            _customer.weixin      = txtWeixin.Text;

            _customer.homeaddress   = txtHomeAddress.Text.Trim();
            _customer.officeaddress = txtOfficeAddress.Text.Trim();
            _customer.sex           = rdbMan.Checked?"男":"女";
            _customer.fox           = txtfox.Text.Trim();

            FishBll.Bll.CustomerBll bll = new FishBll.Bll.CustomerBll();

            bool isok = bll.Exists(_customer.code);

            while (isok)
            {
                _customer.code = FishBll.Bll.SequenceUtil.GetCustomerSequence();
                isok           = bll.Exists(_customer.code);
            }

            bool isExistName = bll.ExistsName(_customer.name);

            if (isExistName)
            {
                MessageBox.Show("数据库中存在相同的联系人名称。");
            }

            int id = bll.Add(_customer);

            if (id > 0)
            {
                _customer.id = id;
                txtCode.Text = _customer.code;

                FishBll.Bll.CustomerOfCompanyBll ccbll = new FishBll.Bll.CustomerOfCompanyBll();
                if (false == string.IsNullOrEmpty(_customer.company))
                {
                    FishEntity.CustomerOfCompanyEntity ccEntity = new FishEntity.CustomerOfCompanyEntity();
                    ccEntity.companyid  = companyId;
                    ccEntity.customerid = _customer.id;
                    ccbll.Add(ccEntity);
                }

                SaveHeaderPicture(id);

                tmiAdd.Visible      = true;
                tmiModify.Visible   = true;
                tmiQuery.Visible    = true;
                tmiPrevious.Visible = true;
                tmiNext.Visible     = true;
                tmiSave.Visible     = false;
                tmiCancel.Visible   = false;

                MessageBox.Show("添加成功。");
            }
            else
            {
                txtCode.Text = string.Empty;
                MessageBox.Show("添加失败。");
            }
        }
Beispiel #9
0
        protected void SetCallRecord()
        {
            if (_entity == null)
            {
                return;
            }

            txtCode.Text        = _entity.code;
            txtAddress.Text     = _entity.address;
            txtCompanyCode.Text = _entity.customercode;
            txtCompanyName.Text = _entity.customer;
            txtContent.Text     = _entity.communicatecontent;
            txtLevel.Text       = _entity.customerlevel;
            txtLinkMan.Text     = _entity.linkman;
            txtLinkManCode.Text = _entity.linkmancode;
            txtMobile.Text      = _entity.mobile;
            txtMonth.Text       = _entity.monthestimate;
            txtOfficeTel.Text   = _entity.officetel;
            txtProducts.Text    = _entity.products;
            txtQuality.Text     = _entity.requiredquantity;
            txtWeek.Text        = _entity.weekestimate;

            DateTime temp = DateTime.Now;

            if (_entity.BuyDate != null && string.IsNullOrEmpty(_entity.BuyDate) != false && _entity.BuyDate.ToString() != "")
            {
                DateTime.TryParse(_entity.BuyDate, out temp);
            }
            dtpBuyDate.Value = temp;

            if (_entity.currentdate != null)
            {
                dtpCurrentDate.Value = _entity.currentdate.Value;
            }

            if (_entity.nextdate != null)
            {
                dtpNextLinkDate.Value = _entity.nextdate.Value;
            }

            FishBll.Bll.CompanyBll   companybll = new FishBll.Bll.CompanyBll();
            FishEntity.CompanyEntity company    = companybll.GetModelByCode(_entity.customercode);
            if (company != null)
            {
                string requiredproduct    = "";
                FishEntity.DictEntity dic = FishEntity.Variable.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.RequiredProduct && i.code == company.requiredproduct); });
                if (dic != null)
                {
                    requiredproduct = dic.name;
                }

                txtspecifacation.Text = requiredproduct;
                txtQuality.Text       = company.productrequire;
                string products = "";
                dic = FishEntity.Variable.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.Products && i.code == company.products); });
                if (dic != null)
                {
                    products = dic.name;
                }
                txtProducts.Text     = products;
                txtcompetitors.Text  = company.competitors;
                txttransportfee.Text = company.freight.ToString("f2");
                txtweight.Text       = company.tare.ToString("f2");
                txtSaleman.Text      = company.salesman;
                string property = "";
                dic = FishEntity.Variable.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.CustomerProperty && i.code == company.customerproperty); });
                if (dic != null)
                {
                    property = dic.name;
                }
                txtCustomerNature.Text = property;

                txtWeek.Text  = company.currentweekestimate;
                txtMonth.Text = company.currentmonthestimate;

                dic = FishEntity.Variable.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.GeneralLevel && i.code == company.generallevel); });
                if (dic != null)
                {
                    txtLevel.Text = dic.name;
                }
            }
        }
Beispiel #10
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(FishEntity.CompanyEntity model)
 {
     return(dal.Update(model));
 }
Beispiel #11
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(FishEntity.CompanyEntity model)
 {
     return(dal.Add(model));
 }