예제 #1
0
        private void BindCountryBrandData()
        {
            if (cmbCountry.Text == string.Empty)
                return;
            string pcode = cmbCountry.Text.ToString();
            FishEntity.DictEntity pModel = InitDataUtil.DictList.Find((i) =>
            {
                return i.code == pcode && i.pcode.Equals(FishEntity.Constant.CountryType);
            });
            int pid = 0;
            if (pModel != null)
            {
                pid = pModel.id;
            }

            List<FishEntity.DictEntity> list = InitDataUtil.DictList.FindAll((i) =>
            {
                return i.pid == pid && i.pcode.Equals(FishEntity.Constant.Brand);
            });
            if (true)
            {
                if (list == null)
                {
                    list = new List<FishEntity.DictEntity>();
                }
                FishEntity.DictEntity empty = new FishEntity.DictEntity();
                empty.code = "-1";
                empty.name = "";
                list.Insert(0, empty);
            }

            cmbBrand.DataSource = list;
            cmbBrand.DisplayMember = "name";
            cmbBrand.ValueMember = "code";
        }
예제 #2
0
        public FormEditDict(string title, FishEntity.DataTypeEnum dataType, FishEntity.DictEntity entity)
        {
            InitializeComponent();

            _dataType             = dataType;
            cmbType.DisplayMember = "Name";
            cmbType.ValueMember   = "Code";

            if (_dataType == FishEntity.DataTypeEnum.SYSTEM)
            {
                cmbType.DataSource = FishEntity.Variable.SystemDataTypeList;
            }
            else
            {
                cmbType.DataSource = FishEntity.Variable.ProductDataTypeList;
            }

            _entity = entity;//修改
            if (_entity != null)
            {
                txtCode.Text          = _entity.code;
                txtName.Text          = _entity.name;
                cmbType.SelectedValue = _entity.pcode;
                numericUpDown1.Value  = _entity.orderid.GetValueOrDefault();
                txtRemark.Text        = _entity.remark;
                cmbPid.SelectedValue  = _entity.pid;
            }
            this.Text = title;
        }
예제 #3
0
        protected string gethzrswhere()
        {
            string where = " and cooperation in  ";
            String temp = "";

            foreach (UILibrary.CheckBoxComboBox.CheckBoxComboBoxItem item in cmbhzrs.CheckBoxItems)
            {
                if (item.Checked)
                {
                    if (temp != "")
                    {
                        temp += ",";
                    }
                    FishEntity.DictEntity kv = ((UILibrary.CheckBoxComboBox.ObjectSelectionWrapper <FishEntity.DictEntity>)item.ComboBoxItem).Item;
                    temp += "'" + kv.code + "'";
                }
            }

            if (string.IsNullOrEmpty(temp))
            {
                return("");
            }

            return(where + " ( " + temp + " ) ");
        }
예제 #4
0
        private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }

            string fishcode = dataGridView1.Rows[e.RowIndex].Cells["code"].Value.ToString();

            if (fishcode.Equals("分组小计") == false)
            {
                SetValue(e.RowIndex, fishcode);
            }


            if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("nature"))
            {
                if (e.Value != null)
                {
                    string natureid = e.Value.ToString();
                    FishEntity.DictEntity entity = InitDataUtil.DictList.Find((i) => { return(i.code == natureid && i.pcode == FishEntity.Constant.CountryType); });
                    if (entity != null)
                    {
                        e.Value = entity.name;
                    }
                }
            }
        }
예제 #5
0
        protected void BindArea()
        {
            //cmbArea.DataSource = null;
            if (cmbProvince.SelectedValue == null)
            {
                return;
            }
            string pcode = cmbProvince.SelectedValue.ToString();

            FishEntity.DictEntity pModel = InitDataUtil.DictList.Find((i) => { return(i.code == pcode && i.pcode.Equals(FishEntity.Constant.Province)); });
            int pid = 0;

            if (pModel != null)
            {
                pid = pModel.id;
            }


            List <FishEntity.DictEntity> list = InitDataUtil.DictList.FindAll((i) => { return(i.pid == pid && i.pcode.Equals(FishEntity.Constant.Area)); });

            if (list == null)
            {
                list = new List <FishEntity.DictEntity>();
            }

            FishEntity.DictEntity empty = new FishEntity.DictEntity();
            empty.code = "-1";
            empty.name = "";
            list.Insert(0, empty);


            cmbArea.ValueMember   = "code";
            cmbArea.DisplayMember = "name";
            cmbArea.DataSource    = list;
        }
예제 #6
0
        private void InitData()
        {
            List <FishEntity.DictEntity> list = InitDataUtil.DictList.FindAll((i) => { return(i.pcode.Equals(FishEntity.Constant.Goods)); });

            if (list == null)
            {
                list = new List <FishEntity.DictEntity>();
            }

            FishEntity.DictEntity empty = new FishEntity.DictEntity();
            empty.name = "";
            empty.code = "-1";
            list.Insert(0, empty);

            productname.DataSource    = list;
            productname.DisplayMember = "name";
            productname.ValueMember   = "code";

            list = InitDataUtil.DictList.FindAll((i) => { return(i.pcode.Equals(FishEntity.Constant.Specification)); });
            if (list == null)
            {
                list = new List <FishEntity.DictEntity>();
            }

            empty      = new FishEntity.DictEntity();
            empty.name = "";
            empty.code = "-1";
            list.Insert(0, empty);

            specification.DataSource    = list;
            specification.DisplayMember = "name";
            specification.ValueMember   = "code";
        }
예제 #7
0
        protected void SetDetail(List <FishEntity.CheckDetailEntity> details)
        {
            dataGridView1.Rows.Clear();
            if (details == null || details.Count < 1)
            {
                return;
            }

            SortedDictionary <int, List <FishEntity.CheckDetailEntity> > lines = Group(details);

            foreach (KeyValuePair <int, List <FishEntity.CheckDetailEntity> > item in lines)
            {
                int             idx = dataGridView1.Rows.Add();
                DataGridViewRow row = dataGridView1.Rows[idx];
                row.Cells["line"].Value = item.Key;

                foreach (FishEntity.CheckDetailEntity child in item.Value)
                {
                    FishEntity.DictEntity dict = _columns.Find((i) => { return(i.code.Equals(child.checkkey)); });
                    if (dict == null)
                    {
                        continue;
                    }

                    if (dataGridView1.Columns.Contains(child.checkkey + "_id"))
                    {
                        row.Cells[child.checkkey + "_id"].Value = child.id;
                    }
                    if (dataGridView1.Columns.Contains(child.checkkey))
                    {
                        row.Cells[child.checkkey].Value = child.checkvalue;
                    }
                }
            }
        }
예제 #8
0
        protected List <FishEntity.CheckDetailEntity> GetDetails(int mid)
        {
            if (_columns == null)
            {
                return(null);
            }

            dataGridView1.EndEdit();

            List <FishEntity.CheckDetailEntity> listNews = new List <FishEntity.CheckDetailEntity>();
            int lineidx = 0;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.IsNewRow)
                {
                    continue;
                }

                //int did = 0;
                //if (row.Cells["id"].Value != null)
                //{
                //    int.TryParse(row.Cells["id"].Value.ToString(), out did);
                //}

                lineidx = row.Index;

                for (int i = 0; i < dataGridView1.ColumnCount; i++)
                {
                    string colname = dataGridView1.Columns[i].Name;
                    FishEntity.DictEntity check = _columns.Find(k => { return(k.code.Equals(colname)); });
                    if (check == null)
                    {
                        continue;
                    }

                    string value = row.Cells[check.code].Value == null ? string.Empty : row.Cells[check.code].Value.ToString();

                    int did = 0;
                    if (row.Cells[check.code + "_id"].Value != null)
                    {
                        int.TryParse(row.Cells[check.code + "_id"].Value.ToString(), out did);
                    }

                    FishEntity.CheckDetailEntity item = new FishEntity.CheckDetailEntity();
                    item.mid        = mid;
                    item.id         = did;
                    item.checkkey   = check.code;
                    item.checkvalue = value;
                    item.line       = lineidx;
                    item.orderid    = dataGridView1.Columns[i].Index;
                    listNews.Add(item);
                }
            }

            return(listNews);
        }
예제 #9
0
        private void FormProductContract1_Load(object sender, EventArgs e)
        {
            //tmiDelete.Visible = false;
            //tmiExport.Visible = false;
            //tmiSave.Visible = false;
            //tmiCancel.Visible = false;

            //AddMenu();

            List <FishEntity.DictEntity> list = InitDataUtil.DictList.FindAll((i) => { return(i.pcode.Equals(FishEntity.Constant.Goods)); });

            if (list == null)
            {
                list = new List <FishEntity.DictEntity>();
            }

            FishEntity.DictEntity empty = new FishEntity.DictEntity();
            empty.name = "";
            empty.code = "-1";
            list.Insert(0, empty);

            productname.DataSource    = list;
            productname.DisplayMember = "name";
            productname.ValueMember   = "code";

            list = InitDataUtil.DictList.FindAll((i) => { return(i.pcode.Equals(FishEntity.Constant.Specification)); });
            if (list == null)
            {
                list = new List <FishEntity.DictEntity>();
            }

            empty      = new FishEntity.DictEntity();
            empty.name = "";
            empty.code = "-1";
            list.Insert(0, empty);

            specification.DataSource    = list;
            specification.DisplayMember = "name";
            specification.ValueMember   = "code";

            list = InitDataUtil.DictList.FindAll((i) => { return(i.pcode.Equals(FishEntity.Constant.CountryType)); });
            if (list == null)
            {
                list = new List <FishEntity.DictEntity>();
            }

            empty      = new FishEntity.DictEntity();
            empty.name = "";
            empty.code = "-1";
            list.Insert(0, empty);

            nature.DataSource    = list;
            nature.DisplayMember = "name";
            nature.ValueMember   = "code";
        }
예제 #10
0
파일: DictDao.cs 프로젝트: icprog/ZhengDong
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public FishEntity.DictEntity DataRowToModel(DataRow row)
 {
     FishEntity.DictEntity model = new FishEntity.DictEntity();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["code"] != null)
         {
             model.code = row["code"].ToString();
         }
         if (row["name"] != null)
         {
             model.name = row["name"].ToString();
         }
         if (row["pcode"] != null)
         {
             model.pcode = row["pcode"].ToString();
         }
         if (row["isdelete"] != null && row["isdelete"].ToString() != "")
         {
             model.isdelete = int.Parse(row["isdelete"].ToString());
         }
         if (row["orderid"] != null && row["orderid"].ToString() != "")
         {
             model.orderid = int.Parse(row["orderid"].ToString());
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["issystem"] != null && row["issystem"].ToString() != "")
         {
             model.issystem = int.Parse(row["issystem"].ToString());
         }
         if (row["createtime"] != null && row["createtime"].ToString() != "")
         {
             model.createtime = DateTime.Parse(row["createtime"].ToString());
         }
         if (row["modifytime"] != null && row["modifytime"].ToString() != "")
         {
             model.modifytime = DateTime.Parse(row["modifytime"].ToString());
         }
         if (row["pid"] != null && row["pid"].ToString() != "")
         {
             model.pid = int.Parse(row["pid"].ToString());
         }
     }
     return(model);
 }
예제 #11
0
파일: DictDao.cs 프로젝트: icprog/ZhengDong
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(FishEntity.DictEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update t_dict set ");
            strSql.Append("code=@code,");
            strSql.Append("name=@name,");
            strSql.Append("pcode=@pcode,");
            strSql.Append("isdelete=@isdelete,");
            strSql.Append("orderid=@orderid,");
            strSql.Append("remark=@remark,");
            strSql.Append("issystem=@issystem,");
            strSql.Append("modifytime=@modifytime,");
            strSql.Append("pid=@pid");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@code",       MySqlDbType.VarChar,     45),
                new MySqlParameter("@name",       MySqlDbType.VarChar,    100),
                new MySqlParameter("@pcode",      MySqlDbType.VarChar,     45),
                new MySqlParameter("@isdelete",   MySqlDbType.Int16,        6),
                new MySqlParameter("@orderid",    MySqlDbType.Int32,       11),
                new MySqlParameter("@remark",     MySqlDbType.VarChar,    100),
                new MySqlParameter("@issystem",   MySqlDbType.Int16,        6),
                new MySqlParameter("@modifytime", MySqlDbType.Timestamp),
                new MySqlParameter("@pid",        MySqlDbType.Int32,        8),
                new MySqlParameter("@id",         MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.code;
            parameters[1].Value = model.name;
            parameters[2].Value = model.pcode;
            parameters[3].Value = model.isdelete;
            parameters[4].Value = model.orderid;
            parameters[5].Value = model.remark;
            parameters[6].Value = model.issystem;
            parameters[7].Value = DateTime.Now;     //model.modifytime;
            parameters[8].Value = model.pid;
            parameters[9].Value = model.id;

            int rows = MySqlHelper.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #12
0
        private void dataGridView4_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            if (dataGridView4.Columns [e.ColumnIndex].Name.Equals("yfCountry", StringComparison.OrdinalIgnoreCase) == true)
            {
                string pcode = dataGridView4.Rows [e.RowIndex].Cells ["yfCountry"].Value.ToString( );
                FishEntity.DictEntity pModel = InitDataUtil.DictList.Find((i) =>
                {
                    return(i.code == pcode && i.pcode.Equals(FishEntity.Constant.CountryType));
                });
                int pid = 0;
                if (pModel != null)
                {
                    pid = pModel.id;
                }

                List <FishEntity.DictEntity> list = InitDataUtil.DictList.FindAll((i) =>
                {
                    return(i.pid == pid && i.pcode.Equals(FishEntity.Constant.Brand));
                });
                if (true)
                {
                    if (list == null)
                    {
                        list = new List <FishEntity.DictEntity> ( );
                    }
                    FishEntity.DictEntity empty = new FishEntity.DictEntity( );
                    empty.code = "-1";
                    empty.name = "";
                    list.Insert(0, empty);
                }

                //pp . DataSource = list;
                //pp . DisplayMember = "name";

                if (list != null)
                {
                    //pp . Items . Clear ( );
                    foreach (FishEntity.DictEntity em in list)
                    {
                        yfpp.Items.Add(em.name);
                    }
                }
            }
        }
예제 #13
0
파일: DictDao.cs 프로젝트: icprog/ZhengDong
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(FishEntity.DictEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into t_dict(");
            strSql.Append("code,name,pcode,isdelete,orderid,remark,issystem,createtime,modifytime,pid)");
            strSql.Append(" values (");
            strSql.Append("@code,@name,@pcode,@isdelete,@orderid,@remark,@issystem,@createtime,@modifytime,@pid)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@code",       MySqlDbType.VarChar,     45),
                new MySqlParameter("@name",       MySqlDbType.VarChar,    100),
                new MySqlParameter("@pcode",      MySqlDbType.VarChar,     45),
                new MySqlParameter("@isdelete",   MySqlDbType.Int16,        6),
                new MySqlParameter("@orderid",    MySqlDbType.Int32,       11),
                new MySqlParameter("@remark",     MySqlDbType.VarChar,    100),
                new MySqlParameter("@issystem",   MySqlDbType.Int16,        6),
                new MySqlParameter("@createtime", MySqlDbType.Timestamp),
                new MySqlParameter("@modifytime", MySqlDbType.Timestamp),
                new MySqlParameter("@pid",        MySqlDbType.Int32, 8)
            };
            parameters[0].Value = model.code;
            parameters[1].Value = model.name;
            parameters[2].Value = model.pcode;
            parameters[3].Value = model.isdelete;
            parameters[4].Value = model.orderid;
            parameters[5].Value = model.remark;
            parameters[6].Value = model.issystem;
            parameters[7].Value = model.createtime;
            parameters[8].Value = model.modifytime;
            parameters[9].Value = model.pid;

            int rows = MySqlHelper.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #14
0
        public override int Modify()
        {
            if (dataGridView1.CurrentRow == null)
            {
                MessageBox.Show("请选择要编辑的行");
                return(0);
            }
            FishEntity.DictEntity entity = dataGridView1.CurrentRow.DataBoundItem as FishEntity.DictEntity;
            if (entity == null)
            {
                MessageBox.Show("请选择要编辑的行");
                return(0);
            }
            FormEditDict form = new  FormEditDict("编辑数据", FishEntity.DataTypeEnum.BUSINESS, entity);

            form.ShowInTaskbar = false;
            form.RefreshEvent += form_RefreshEvent;
            form.ShowDialog();
            return(0);
        }
        private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            string val = dataGridView1.Rows[e.RowIndex].Cells["cooperation"].Value.ToString();

            FishEntity.DictEntity dic = InitDataUtil.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.Cooperation && i.code == val); });
            if (dic != null)
            {
                dataGridView1.Rows[e.RowIndex].Cells["cooperationstr"].Value = dic.name;
            }

            val = dataGridView1.Rows[e.RowIndex].Cells["paymethod"].Value.ToString();
            dic = InitDataUtil.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.Paymethod && i.code == val); });
            if (dic != null)
            {
                dataGridView1.Rows[e.RowIndex].Cells["paymethodstr"].Value = dic.name;
            }
            val = dataGridView1.Rows[e.RowIndex].Cells["customerproperty"].Value.ToString();
            dic = InitDataUtil.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.CustomerProperty && i.code == val); });
            if (dic != null)
            {
                dataGridView1.Rows[e.RowIndex].Cells["customerpropertystr"].Value = dic.name;
            }
            val = dataGridView1.Rows[e.RowIndex].Cells["products"].Value.ToString();
            dic = InitDataUtil.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.Products && i.code == val); });
            if (dic != null)
            {
                dataGridView1.Rows[e.RowIndex].Cells["productsstr"].Value = dic.name;
            }

            val = dataGridView1.Rows[e.RowIndex].Cells["requiredquantity"].Value.ToString();
            dic = InitDataUtil.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.RequiredProduct && i.code == val); });
            if (dic != null)
            {
                dataGridView1.Rows[e.RowIndex].Cells["requiredquantitystr"].Value = dic.name;
            }
        }
예제 #16
0
        private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("spotstoragedate", StringComparison.InvariantCultureIgnoreCase))
            {
                if (e.Value != null)
                {
                    try
                    {
                        DateTime dt = DateTime.Parse(e.Value.ToString());
                        e.Value = dt.ToString("yyyy.MM.dd");
                    }
                    catch { }
                }
            }

            if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("nature"))
            {
                if (e.Value != null)
                {
                    string natureid = e.Value.ToString();
                    FishEntity.DictEntity entity = InitDataUtil.DictList.Find((i) => { return(i.code == natureid && i.pcode == FishEntity.Constant.CountryType); });
                    if (entity != null)
                    {
                        e.Value = entity.name;
                    }
                }
            }

            string fishcode = dataGridView1.Rows[e.RowIndex].Cells["code"].Value.ToString();

            if (fishcode.Equals("分组小计") == false)
            {
                SetValue(e.RowIndex, fishcode);
            }
        }
예제 #17
0
        protected string getcustomertypewhere()
        {
            string where = "  ";
            foreach (UILibrary.CheckBoxComboBox.CheckBoxComboBoxItem item in cmbType.CheckBoxItems)
            {
                if (item.Checked)
                {
                    FishEntity.DictEntity kv = ((UILibrary.CheckBoxComboBox.ObjectSelectionWrapper <FishEntity.DictEntity>)item.ComboBoxItem).Item;

                    if (kv.code.Equals("供应商"))
                    {
                        where += " and type_suppliers = '1'"; continue;
                    }
                    if (kv.code.Equals("代理商"))
                    {
                        where += " and type_agents ='1'"; continue;
                    }
                    if (kv.code.Equals("客户"))
                    {
                        where += " and type_customer = '1'"; continue;
                    }
                    if (kv.code.Equals("贸易商"))
                    {
                        where += " and type_merchants = '1'"; continue;
                    }
                    if (kv.code.Equals("货代商"))
                    {
                        where += " and type_goods = '1'"; continue;
                    }
                    if (kv.code.Equals("报盘商"))
                    {
                        where += " and type_quote = '1'"; continue;
                    }
                }
            }
            return("  " + where + "  ");
        }
예제 #18
0
파일: DictDao.cs 프로젝트: icprog/ZhengDong
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public FishEntity.DictEntity GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,code,name,pcode,isdelete,orderid,remark,issystem,createtime,modifytime,pid from t_dict ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #19
0
        private void BindCountryBrandData()
        {
            //cmbBand.DataSource = null;
            if (country.SelectedValue == null)
            {
                return;
            }
            string pcode = country.SelectedValue.ToString();

            FishEntity.DictEntity pModel = InitDataUtil.DictList.Find((i) => { return(i.code == pcode && i.pcode.Equals(FishEntity.Constant.CountryType)); });
            int pid = 0;

            if (pModel != null)
            {
                pid = pModel.id;
            }


            List <FishEntity.DictEntity> list = InitDataUtil.DictList.FindAll((i) => { return(i.pid == pid && i.pcode.Equals(FishEntity.Constant.Brand)); });

            if (true)
            {
                if (list == null)
                {
                    list = new List <FishEntity.DictEntity>();
                }
                FishEntity.DictEntity empty = new FishEntity.DictEntity();
                empty.code = string.Empty;
                empty.name = string.Empty;
                list.Insert(0, empty);
            }

            brand.DisplayMember = "name";
            brand.ValueMember   = "code";
            brand.DataSource    = list;
        }
예제 #20
0
        public FormCallRecordsTable()
        {
            InitializeComponent();
            menuStrip1.Items.Remove(tmiQuery);
            menuStrip1.Items.Remove(tmiAdd);
            menuStrip1.Items.Remove(tmiModify);
            menuStrip1.Items.Insert(menuStrip1.Items.IndexOf(tmiClose), tmiQuery);
            menuStrip1.Items.Insert(menuStrip1.Items.IndexOf(tmiClose), tmiAdd);
            menuStrip1.Items.Insert(menuStrip1.Items.IndexOf(tmiClose), tmiModify);

            ReadColumnConfig(dataGridView1, "Set_CallRecordsTable_1");
            //ReadColumnConfig(dataGridView2, "Set_CallRecordsTable_2");

            cmbProvince.SelectedValueChanged -= cmbProvince_SelectedValueChanged;
            InitDataUtil.BindComboBoxData(cmbProvince, FishEntity.Constant.Province, true);
            cmbProvince.SelectedValueChanged += cmbProvince_SelectedValueChanged;
            BindArea();

            BindCustomerType(FishEntity.Constant.Type);
            BindHZHB();


            List <FishEntity.DictEntity> list = InitDataUtil.DictList.FindAll((i) => { return(i.pcode.Equals(FishEntity.Constant.Paymethod)); });

            if (list == null)
            {
                list = new List <FishEntity.DictEntity>();
            }

            FishEntity.DictEntity empty = new FishEntity.DictEntity();
            empty.name = "";
            empty.code = "-1";
            list.Insert(0, empty);

            cmbPayMethod.DataSource    = list;
            cmbPayMethod.DisplayMember = "name";
            cmbPayMethod.ValueMember   = "code";

            if (FishEntity.Variable.User.roletype.Equals(FishEntity.Constant.Role_SalesMan))
            {
                cmbTheperson.Enabled = false;
                cmbTheperson.Visible = false;
                label12.Visible      = false;
            }
            FishBll.Bll.PersonBll bll = new FishBll.Bll.PersonBll();

            List <FishEntity.PersonEntity> list1 = bll.id_name();

            if (list1 == null)
            {
                list1 = new List <FishEntity.PersonEntity>();
            }
            FishEntity.PersonEntity tmep = new FishEntity.PersonEntity();

            tmep.username = "******";
            list1.Insert(0, tmep);

            cmbTheperson.DataSource    = list1;
            cmbTheperson.DisplayMember = "username";
            cmbTheperson.ValueMember   = "username";
        }
예제 #21
0
        private void FormCallRecords_Load(object sender, EventArgs e)
        {
            dgvUtil = new UILibrary.TwoDimenDataGridView(dataGridView1);
            UILibrary.TwoDimenDataGridView.TopHeader header = new UILibrary.TwoDimenDataGridView.TopHeader(10, 10, "保证实测指标");
            dgvUtil.Headers.Add(header);

            List <FishEntity.DictEntity> list = InitDataUtil.DictList.FindAll((i) => { return(i.pcode.Equals(FishEntity.Constant.CountryType)); });

            if (list == null)
            {
                list = new List <FishEntity.DictEntity>();
            }

            FishEntity.DictEntity empty = new FishEntity.DictEntity();
            empty.name = "";
            empty.code = "-1";
            list.Insert(0, empty);

            nature.DataSource    = list;
            nature.DisplayMember = "name";
            nature.ValueMember   = "code";

            list = InitDataUtil.DictList.FindAll((i) => { return(i.pcode.Equals(FishEntity.Constant.Specification)); });
            if (list == null)
            {
                list = new List <FishEntity.DictEntity>();
            }

            empty      = new FishEntity.DictEntity();
            empty.name = "";
            empty.code = "-1";
            list.Insert(0, empty);

            specification.DataSource    = list;
            specification.DisplayMember = "name";
            specification.ValueMember   = "code";

            list = InitDataUtil.DictList.FindAll((i) => { return(i.pcode.Equals(FishEntity.Constant.Brand)); });
            if (list == null)
            {
                list = new List <FishEntity.DictEntity>();
            }

            empty      = new FishEntity.DictEntity();
            empty.name = "";
            empty.code = "-1";
            list.Insert(0, empty);

            brand.DataSource    = list;
            brand.DisplayMember = "name";
            brand.ValueMember   = "code";

            list = InitDataUtil.DictList.FindAll((i) => { return(i.pcode.Equals(FishEntity.Constant.Paymethod)); });
            if (list == null)
            {
                list = new List <FishEntity.DictEntity>();
            }

            empty      = new FishEntity.DictEntity();
            empty.name = "";
            empty.code = "-1";
            list.Insert(0, empty);

            paymethod.DataSource    = list;
            paymethod.DisplayMember = "name";
            paymethod.ValueMember   = "code";
        }
예제 #22
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(FishEntity.DictEntity model)
 {
     return(dal.Update(model));
 }
예제 #23
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(FishEntity.DictEntity model)
 {
     return(dal.Add(model));
 }
예제 #24
0
        private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }
            if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("maxcurrentdate", StringComparison.InvariantCultureIgnoreCase) ||
                dataGridView1.Columns[e.ColumnIndex].Name.Equals("maxnextdate", StringComparison.InvariantCultureIgnoreCase)
                )
            {
                if (e.Value != null)
                {
                    try
                    {
                        DateTime dt = DateTime.Parse(e.Value.ToString());
                        e.Value = dt.ToString("MM.dd");
                    }
                    catch { }
                }
            }
            string val = dataGridView1.Rows[e.RowIndex].Cells["cooperation"].Value.ToString();

            FishEntity.DictEntity dic = InitDataUtil.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.Cooperation && i.code == val); });
            if (dic != null)
            {
                dataGridView1.Rows[e.RowIndex].Cells["cooperationstr"].Value = dic.name;
            }

            val = dataGridView1.Rows[e.RowIndex].Cells["paymethod"].Value.ToString();
            dic = InitDataUtil.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.Paymethod && i.code == val); });
            if (dic != null)
            {
                dataGridView1.Rows[e.RowIndex].Cells["paymethodstr"].Value = dic.name;
            }
            val = dataGridView1.Rows[e.RowIndex].Cells["customerproperty"].Value.ToString();
            dic = InitDataUtil.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.CustomerProperty && i.code == val); });
            if (dic != null)
            {
                dataGridView1.Rows[e.RowIndex].Cells["customerpropertystr"].Value = dic.name;
            }
            val = dataGridView1.Rows[e.RowIndex].Cells["products"].Value.ToString();
            dic = InitDataUtil.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.Products && i.code == val); });
            if (dic != null)
            {
                dataGridView1.Rows[e.RowIndex].Cells["productsstr"].Value = dic.name;
            }

            val = dataGridView1.Rows[e.RowIndex].Cells["requiredquantity"].Value.ToString();
            dic = InitDataUtil.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.RequiredProduct && i.code == val); });
            if (dic != null)
            {
                dataGridView1.Rows[e.RowIndex].Cells["requiredquantitystr"].Value = dic.name;
            }
            if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("maxcurrentdate", StringComparison.InvariantCultureIgnoreCase) ||
                dataGridView1.Columns[e.ColumnIndex].Name.Equals("maxnextdate", StringComparison.InvariantCultureIgnoreCase)
                )
            {
                if (e.Value != null)
                {
                    try
                    {
                        DateTime dt = DateTime.Parse(e.Value.ToString());
                        e.Value = dt.ToString("MM.dd");
                    }
                    catch { }
                }
            }
        }
예제 #25
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;
                }
            }
        }
예제 #26
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (Check() == false)
            {
                this.DialogResult = System.Windows.Forms.DialogResult.None;
                return;
            }

            bool isAdd = false;

            if (_entity == null)
            {
                _entity          = new FishEntity.DictEntity();
                _entity.isdelete = 0;
                _entity.issystem = _dataType == FishEntity.DataTypeEnum.SYSTEM ? 1 : 0;
                isAdd            = true;
            }
            else
            {
                string code = txtCode.Text.Trim();
                if (_entity.code.Equals(code) == false)
                {
                    FishBll.Bll.DictBll bll = new FishBll.Bll.DictBll();
                    if (bll.Exists(code, cmbType.SelectedValue.ToString(), _entity.issystem))
                    {
                        MessageBox.Show("代码已经存在,请修改其他值。");
                        this.DialogResult = System.Windows.Forms.DialogResult.None;
                        return;
                    }
                }
            }

            _entity.code    = txtCode.Text.Trim();
            _entity.name    = txtName.Text.Trim();
            _entity.pcode   = cmbType.SelectedValue.ToString();
            _entity.orderid = (int)numericUpDown1.Value;
            _entity.remark  = txtRemark.Text.Trim();

            if (_entity.pcode.Equals(FishEntity.Constant.Area))
            {
                _entity.pid = int.Parse(cmbPid.SelectedValue.ToString());
            }
            else if (_entity.pcode.Equals(FishEntity.Constant.Brand))
            {
                _entity.pid = int.Parse(cmbPid.SelectedValue.ToString());
            }
            else
            {
                _entity.pid = 0;
            }

            if (isAdd)
            {
                FishBll.Bll.DictBll bll = new FishBll.Bll.DictBll();
                if (bll.Exists(_entity.code, _entity.pcode, _entity.issystem))
                {
                    MessageBox.Show("代码已经存在,请修改其他值。");
                    this.DialogResult = System.Windows.Forms.DialogResult.None;
                    return;
                }

                bool isOk = bll.Add(_entity);
                if (isOk)
                {
                    OnRefresh();
                }
            }
            else
            {
                FishBll.Bll.DictBll bll = new FishBll.Bll.DictBll();
                bool isOk = bll.Update(_entity);
                if (isOk)
                {
                    OnRefresh();
                }
            }

            InitDataUtil.DictList = null;
        }