コード例 #1
0
 private void 采购明细统计_Load(object sender, EventArgs e)
 {
     myEntity = new MYDBEntities2();
     cmbType.SelectedIndex = 0;
     InitUsers();
     InitData();
 }
コード例 #2
0
 private void 采购借款记录_Load(object sender, EventArgs e)
 {
     if (Mydb == null)
     {
         Mydb = new MYDBEntities2();
     }
     btnWriteOff.Visible = DisplayWriteOff;
     InitData();
     dgvLoan.DataSource           = DaLoanBindingSource;
     dgvLoan.DataBindingComplete += Classes.PubFunc.dgv_DataBindingComplete;
 }
コード例 #3
0
        public bool MultiSelect         = false;            //是否可以多选

        private void  择供应商_Load(object sender, EventArgs e)
        {
            dgvDaSupplier.MultiSelect = MultiSelect;
            if (myEntity == null)
            {
                myEntity = new MYDBEntities2();
            }
            //获取现有的关系
            mDaSupplier = myEntity.DaGoodsSuppliers.Where(d => d.IntGoodsID == mDaGoodsID).Select(d => d.DaSupplier.IntID).ToList();
            InitData();
            SearchData();
        }
コード例 #4
0
        private void 到货信息编辑_Load(object sender, EventArgs e)
        {
            myEntity = new MYDBEntities2();

            /*
             * //判断是否有货物已入库
             * var mStockIn = myEntity.DaStockIns.Where(d => d.IntContractID == mContractID).ToList();
             *
             * if (mStockIn.Count > 0)
             *  mDaStockInID = mStockIn[0].IntID;
             */
            InitData();
        }
コード例 #5
0
        private void 采购合同编辑_Load(object sender, EventArgs e)
        {
            if (myEntity == null)
            {
                myEntity = new MYDBEntities2();
            }
            InitGoodsTable();
            DaSupplierBindingSource.DataSource = goodsTable;
            dgvPurchaseGoods.DataSource        = DaSupplierBindingSource;
            isLoading = true;
            InitCmbDaType();
            InitData();

            isLoading = false;
        }
コード例 #6
0
 private void  择采购物品_Load(object sender, EventArgs e)
 {
     if (myEntity == null)
     {
         myEntity = new MYDBEntities2();
     }
     //if(DaGoods != null)
     //{
     //    //已选择,显示选择的物品;
     //    txtGoodsNum.Text = DaGoods.VcNum;
     //    txtGoodsName.Text = DaGoods.VcName;
     //}
     InitGoodsNameData();
     InitDataBinding();
 }
コード例 #7
0
        private void 发票信息编辑_Load(object sender, EventArgs e)
        {
            if (myEntity == null)
            {
                myEntity = new MYDBEntities2();
            }
            //获取已到票信息
            var mDaInvoice = myEntity.DaInvoices.Where(d => d.IntContractGoodsID == MContractGoodsId).ToList();

            if (mDaInvoice.Count > 0)
            {
                MInvoiceId = mDaInvoice[0].IntID;
            }

            InitData();
        }
コード例 #8
0
        private void InitData()
        {
            if (myEntity == null)
            {
                myEntity = new MYDBEntities2();
            }

            ZDUnitBindingSource.DataSource = myEntity.ZdGoodsUnits.ToList();
            cmbUnit.DataSource             = ZDUnitBindingSource;
            cmbUnit.DisplayMember          = "VcDesc";
            cmbUnit.ValueMember            = "ID";

            if (mDaGoodsID > 0)
            {
                //修改
                mDaGoods = myEntity.DaGoods1.SingleOrDefault(d => d.IntID == mDaGoodsID);
                oldNum   = mDaGoods.VcNum;
                //mDaGoodsTypeID = mda
                //cmbUnit.SelectedValue = mDaGoods.IntUnit;
            }
            else
            {
                //新增
                string maxNum;
                GetMaxNum("1", out maxNum);
                mDaGoods = new DaGoods()
                {
                    IntTypeID = mDaGoodsTypeID, VcNum = maxNum, IntStatus = 0
                };
            }

            txtNum.DataBindings.Add("Text", mDaGoods, "VcNum");
            txtName.DataBindings.Add("Text", mDaGoods, "VcName");
            txtNorms.DataBindings.Add("Text", mDaGoods, "VcNorms");
            txtRemark.DataBindings.Add("Text", mDaGoods, "VcRemark");
            txtTypeName.Text = myEntity.DaGoodsTypes.SingleOrDefault(d => d.IntID == mDaGoods.IntTypeID).VcType;// mDaGoodsTypeName;
            txtPrice.DataBindings.Add("Text", mDaGoods, "MonPrice", true);

            cmbUnit.DataBindings.Add("SelectedValue", mDaGoods, "IntUnit");
        }
コード例 #9
0
        private void 增加供应商_Load(object sender, EventArgs e)
        {
            if (myEntity == null)
            {
                myEntity = new MYDBEntities2();
            }
            if (DaSupplierID == 0)
            {
                //新增
                string maxNum = myEntity.DaSuppliers.Select(a => a.VcNum).Max();

                maxNum = !string.IsNullOrEmpty(maxNum) ? (Convert.ToInt64(maxNum) + 1).ToString() : "1000001";

                txtDaSupplierNum.Text = maxNum;
            }
            else
            {
                //修改
                //根据DaSupplierID获取供应商
                mDaSupplier         = myEntity.DaSuppliers.Where(d => d.IntID == DaSupplierID).SingleOrDefault();
                txtName.Text        = mDaSupplier.VcName;
                txtRegCapital.Text  = mDaSupplier.VcRegCapital;
                txtLegalRep.Text    = mDaSupplier.VcLegalRep;
                txtTaxID.Text       = mDaSupplier.VcTaxID;
                txtOpeningBank.Text = mDaSupplier.VcOpeningBank;
                txtBankAccount.Text = mDaSupplier.VcBankAccount;
                txtAddress.Text     = mDaSupplier.VcAddress;
                txtWebsite.Text     = mDaSupplier.VcWebsite;
                txtTel.Text         = mDaSupplier.VcTel;
                txtFax.Text         = mDaSupplier.VcFax;
                txtPostCode.Text    = mDaSupplier.VcPostCode;
                txtRemark.Text      = mDaSupplier.VcRemark;

                //DaSupplierbindingSource.DataSource = mDaSupplier;
                //txtName.DataBindings.Add("Text", DaSupplierbindingSource, "VcName");
                //txtRegCapital.DataBindings.Add("Text", DaSupplierbindingSource, "VcRegCapital");
            }
        }
コード例 #10
0
        private void InitData()
        {
            if (myEntity == null)
            {
                myEntity = new MYDBEntities2();
            }

            if (DaContactID > 0)
            {
                //修改
                mDaSuppContact = myEntity.DaSupplierContacts.Where(d => d.IntID == DaContactID).SingleOrDefault();
                DaSupplierID   = mDaSuppContact.IntSupplierID;
            }
            else
            {
                //增加
                mDaSuppContact = new DaSupplierContact()
                {
                    IntSupplierID = DaSupplierID, IntEmpNum = Classes.PubClass.UserId
                };
                DaSupplier daSupplier = myEntity.DaSuppliers.SingleOrDefault(d => d.IntID == DaSupplierID);
                if (daSupplier != null)
                {
                    mDaSuppContact.VcTel = daSupplier.VcTel;
                    mDaSuppContact.VcFax = daSupplier.VcFax;
                }
            }
            bindingSourceDaSuppContact.DataSource = mDaSuppContact;
            txtName.Text = myEntity.DaSuppliers.Where(d => d.IntID == DaSupplierID).SingleOrDefault().VcName;
            txtContactName.DataBindings.Add("Text", bindingSourceDaSuppContact, "VcName");
            txtPost.DataBindings.Add("Text", bindingSourceDaSuppContact, "VcPost");
            txtTel.DataBindings.Add("Text", bindingSourceDaSuppContact, "VcTel");
            txtFax.DataBindings.Add("Text", bindingSourceDaSuppContact, "VcFax");
            txtMobile.DataBindings.Add("Text", bindingSourceDaSuppContact, "VcMobile");
            txtQQ.DataBindings.Add("Text", bindingSourceDaSuppContact, "VcQQ");
            txtEmail.DataBindings.Add("Text", bindingSourceDaSuppContact, "VcEmail");
            txtRemark.DataBindings.Add("Text", bindingSourceDaSuppContact, "VcRemark");
        }
コード例 #11
0
ファイル: LoginForm1.cs プロジェクト: zymITsky/ss
        private void OK_Click(object sender, EventArgs e)
        {
            try
            {
                MYDBEntities2 myEntity = new MYDBEntities2();

                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                string LoginName, Password;

                LoginName = txtLoginName.Text.Trim();
                Password  = txtPassword.Text.Trim();
                List <T_Users> Users = myEntity.T_Users.Where(d => d.LoginName == LoginName).ToList();

                if (Users.Count < 1)
                {
                    MessageBox.Show("登录名输入错误");
                    return;
                }
                else
                {
                    var User = Users.FirstOrDefault();
                    Password = Classes.MD5.Md5Encrypt(Password);
                    if (string.Compare(Password, User.PassWord) != 0)
                    {
                        MessageBox.Show("密码输入错误");
                        txtPassword.Text = "";
                        return;
                    }
                    if (User.UserStatus != "正常")
                    {
                        MessageBox.Show("该账户已停用");
                        return;
                    }
                    if (LoginName.ToLower() == "admin")
                    {
                        CommonClass.SttUser.blSuperUser = true;
                    }
                    else
                    {
                        CommonClass.SttUser.blSuperUser = false;
                    }

                    Classes.PubClass.LoginName  = LoginName;
                    Classes.PubClass.UserId     = User.id;
                    Classes.PubClass.UserName   = User.UserName;
                    Classes.PubClass.UserRight  = User.OperRight;
                    Classes.PubClass.UserStatus = User.UserStatus;
                    Classes.PubClass.UserRoleId = User.IntRoleID ?? -1;

                    //添加权限
                    CommonClass.UserRightList.Clear();
                    销售管理.BLL.Da.GetUserRight(Classes.PubClass.UserRoleId);

                    CommonClass.SttDb.iDBType = 1;
                    isLogined = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            //var mTable = new T_UsersTableAdapter().GetDataByLoginName(LoginName);
            //if (mTable.Rows.Count < 1)
            //{
            //    MessageBox.Show("登录名输入错误");
            //    return;
            //}
            //else
            //{
            //    var mRow = (销售管理.DAL.DataSetUsers.T_UsersRow)mTable.Rows[0];
            //    Password = Classes.MD5.Md5Encrypt(Password);
            //    if (string.Compare(Password, mRow.PassWord) != 0)
            //    {
            //        MessageBox.Show("密码输入错误");
            //        txtPassword.Text = "";
            //        return;
            //    }
            //    Classes.PubClass.LoginName = LoginName;
            //    Classes.PubClass.UserId = mRow.id;
            //    Classes.PubClass.UserName = mRow.UserName;
            //    Classes.PubClass.UserRight = mRow.OperRight;
            //    Classes.PubClass.UserStatus = mRow.UserStatus;
            //    isLogined = true;
            //}
            System.Net.IPAddress[] IPs = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName());
            for (int c = 0; c < IPs.Length; c++)
            {
                if (IPs[c].AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                {
                    new T_LoginLogTableAdapter().Insert(Classes.PubClass.UserId, IPs[c].ToString());
                }
            }

            MainForm mForm = new MainForm(this);

            // mForm.tssb用户名.Text = "登录用户名:"+  Classes.PubClass.UserName +"  | 权限:" + Classes.PubClass.UserRight;
            mForm.LoadModuleListFromDb(Classes.PubClass.UserRoleId);
            mForm.Show();
            //this.DialogResult = DialogResult.OK;
            this.Hide();
        }
コード例 #12
0
        private void OK_Click(object sender, EventArgs e)
        {
            //获取连接字符串
            string        file    = System.Windows.Forms.Application.ExecutablePath;
            Configuration config  = ConfigurationManager.OpenExeConfiguration(file);
            String        xmlPath = "DBInfo.xml";

            if (xmlPath == null)
            {
                MessageBox.Show("请先选择数据源!");
            }
            Common.SqlConnectionSet.SetConnStr(xmlPath.Trim());

            try
            {
                MYDBEntities2 myEntity = new MYDBEntities2();
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                string LoginName, Password;

                LoginName = txtLoginName.Text.Trim();
                Password  = txtPassword.Text.Trim();
                List <T_Users> Users = myEntity.T_Users.Where(d => d.LoginName == LoginName).ToList();

                if (Users.Count < 1)
                {
                    MessageBox.Show("登录名输入错误");
                    return;
                }
                else
                {
                    var User = Users.FirstOrDefault();
                    Password = Classes.MD5.Md5Encrypt(Password);
                    if (string.Compare(Password, User.PassWord) != 0)
                    {
                        MessageBox.Show("密码输入错误");
                        txtPassword.Text = "";
                        return;
                    }
                    if (User.UserStatus != "正常")
                    {
                        MessageBox.Show("该账户已停用");
                        return;
                    }
                    if (LoginName.ToLower() == "admin")
                    {
                        CommonClass.SttUser.blSuperUser = true;
                    }
                    else
                    {
                        CommonClass.SttUser.blSuperUser = false;
                    }
                    Classes.PubClass.LoginName  = LoginName;
                    Classes.PubClass.UserId     = User.id;
                    Classes.PubClass.UserName   = User.UserName;
                    Classes.PubClass.UserRight  = User.OperRight;
                    Classes.PubClass.UserStatus = User.UserStatus;
                    Classes.PubClass.UserRoleId = User.IntRoleID ?? -1;
                    //添加权限
                    CommonClass.UserRightList.Clear();
                    销售管理.BLL.Da.GetUserRight(Classes.PubClass.UserRoleId);
                    CommonClass.SttDb.iDBType = 1;
                    isLogined = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            System.Net.IPAddress[] IPs = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName());
            for (int c = 0; c < IPs.Length; c++)
            {
                if (IPs[c].AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                {
                    new T_LoginLogTableAdapter().Insert(Classes.PubClass.UserId, IPs[c].ToString());
                }
            }

            MainForm mForm = new MainForm(this);

            //mForm.tssb用户名.Text = "登录用户名:"+  Classes.PubClass.UserName +"  | 权限:" + Classes.PubClass.UserRight;
            mForm.LoadModuleListFromDb(Classes.PubClass.UserRoleId);
            mForm.Show();
            //this.DialogResult = DialogResult.OK;
            this.Hide();
        }