Ejemplo n.º 1
0
        void Supplier_Delete()
        {
            try
            {
                c_row_select = dgrSupplier.SelectedIndex;
                Supplier_Info _Supplier_Info = (Supplier_Info)dgrSupplier.SelectedItem;

                if (_Supplier_Info == null)
                {
                    return;
                }

                MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn xóa nhà cung cấp hay không?", "Thông báo", NoteBoxLevel.Question);
                if (MessageBoxResult.Yes == result)
                {
                    if (c_Supplier_Controller.Supplier_Delete(_Supplier_Info.Supplier_Id))
                    {
                        NoteBox.Show("Xóa dữ liệu thành công");
                        LoadData();
                    }
                }
                else
                {
                    DataGridHelper.NVSFocus(dgrSupplier, c_row_select, 0);
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        void Supplier_Update()
        {
            try
            {
                c_row_select = dgrSupplier.SelectedIndex;
                Supplier_Info _Supplier_Info = (Supplier_Info)dgrSupplier.SelectedItem;

                if (_Supplier_Info == null)
                {
                    return;
                }
                frmCreate_Supplier _frmCreate_Supplier = new frmCreate_Supplier();
                _frmCreate_Supplier.c_Supplier_Info = _Supplier_Info;
                _frmCreate_Supplier.c_type          = Convert.ToInt16(Form_Type.Update);
                _frmCreate_Supplier.Owner           = Window.GetWindow(this);
                _frmCreate_Supplier.ShowDialog();

                if (_frmCreate_Supplier.c_id_insert != 0)
                {
                    LoadData();
                }

                DataGridHelper.NVSFocus(dgrSupplier, c_row_select, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Ejemplo n.º 3
0
        void Supplier_Insert()
        {
            try
            {
                frmCreate_Supplier _frmCreate_Supplier = new frmCreate_Supplier();
                _frmCreate_Supplier.c_type = Convert.ToInt16(Form_Type.Insert);
                _frmCreate_Supplier.Owner  = Window.GetWindow(this);
                _frmCreate_Supplier.ShowDialog();

                if (_frmCreate_Supplier.c_id_insert != 0)
                {
                    LoadData();

                    for (int i = 0; i < c_lst.Count; i++)
                    {
                        Supplier_Info ui = (Supplier_Info)c_lst[i];
                        if (ui.Supplier_Id == _frmCreate_Supplier.c_id_insert)
                        {
                            c_row_select = i;
                            _frmCreate_Supplier.c_id_insert = 0;
                            break;
                        }
                    }
                }

                DataGridHelper.NVSFocus(dgrSupplier, c_row_select, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Ejemplo n.º 4
0
        public bool Supplier_Insert(Supplier_Info p_Supplier_Info, ref decimal _id)
        {
            try
            {
                SqlParameter[] spParameter = new SqlParameter[4];

                spParameter[0]           = new SqlParameter("@Supplier_Name", SqlDbType.NVarChar);
                spParameter[0].Direction = ParameterDirection.Input;
                spParameter[0].Value     = p_Supplier_Info.Supplier_Name;

                spParameter[1]           = new SqlParameter("@Phone", SqlDbType.NVarChar);
                spParameter[1].Direction = ParameterDirection.Input;
                spParameter[1].Value     = p_Supplier_Info.Phone;

                spParameter[2]           = new SqlParameter("@Address", SqlDbType.NVarChar);
                spParameter[2].Direction = ParameterDirection.Input;
                spParameter[2].Value     = p_Supplier_Info.Address;

                spParameter[3]           = new SqlParameter("@Supplier_Id", SqlDbType.Int);
                spParameter[3].Direction = ParameterDirection.Output;
                spParameter[3].Value     = _id;

                SqlHelper.ExecuteNonQuery(CommonData.ConnectionString, CommandType.StoredProcedure, "proc_Supplier_Insert", spParameter);

                _id = Convert.ToDecimal(spParameter[3].Value);
                return(true);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
                return(false);
            }
        }
Ejemplo n.º 5
0
 public bool Supplier_Update(decimal p_Supplier_Id, Supplier_Info p_Supplier_Info)
 {
     try
     {
         return(true);
     }
     catch (Exception ex)
     {
         CommonData.log.Error(ex.ToString());
         return(false);
     }
 }
        public Supplier_Info Get_Supplier_Info_By_Id(int ID)
        {
            Supplier_Info _Supplier_Info = new Supplier_Info();

            DataTable dt = Supplier_Info_DA.Get_Supplier_Info_By_Id(ID);

            foreach (DataRow row in dt.Rows)
            {
                _Supplier_Info.ID = ID;
                _Supplier_Info.Code = row["Code"].ToString();
                _Supplier_Info.Name = row["Name"].ToString();
                _Supplier_Info.Address = row["Address"].ToString();
                _Supplier_Info.Zip_Postal = row["Zip/Postal"].ToString();
                _Supplier_Info.State_Province = row["State/Province"].ToString();
                _Supplier_Info.Phone = row["Phone"].ToString();
                _Supplier_Info.City = row["City"].ToString();
                _Supplier_Info.Country = row["Country"].ToString();
                _Supplier_Info.Fax = row["Fax"].ToString();
                _Supplier_Info.ST_Reg = row["ST_Reg"].ToString();
                _Supplier_Info.STRegNTA = row["STRegNTA"].ToString();
            }
            return _Supplier_Info;
        }
        public string Update(int ID, string Code, string Name, string Address, string Zip_Postal,
            string State_Province, string Phone, string City, string Country, string Fax, string ST_Reg, string STRegNTA)
        {
            Supplier_Info _Supplier_Info = new Supplier_Info();
            _Supplier_Info.ID = ID;
            _Supplier_Info.Code = Code;
            _Supplier_Info.Name = Name;
            _Supplier_Info.Address = Address;
            _Supplier_Info.Zip_Postal = Zip_Postal;
            _Supplier_Info.State_Province = State_Province;
            _Supplier_Info.Phone = Phone;
            _Supplier_Info.City = City;
            _Supplier_Info.Country = Country;
            _Supplier_Info.Fax = Fax;
            _Supplier_Info.ST_Reg = ST_Reg;
            _Supplier_Info.STRegNTA = STRegNTA;
            _Supplier_Info.UpdatedBy = Session["User"].ToString();

            if (_Supplier_Info.UpdatedBy.ToString().ToUpper() == ("Mr. Asif").ToString().ToUpper() || _Supplier_Info.UpdatedBy.ToString().ToUpper() == ("Saud Piracha").ToString().ToUpper() || _Supplier_Info.UpdatedBy.ToString().ToUpper() == ("USAMA").ToString().ToUpper())
            {
                return Supplier_Info_DA.Update(_Supplier_Info);
            }
            else
            {
                return "-1";
            }
        }
        public string Insert(string Code, string Name, string Address, string Zip_Postal,
            string State_Province, string Phone, string City, string Country, string Fax, string ST_Reg, string STRegNTA)
        {
            Supplier_Info _Supplier_Info = new Supplier_Info();
            _Supplier_Info.Code = Code;
            _Supplier_Info.Name = Name;
            _Supplier_Info.Address = Address;
            _Supplier_Info.Zip_Postal = Zip_Postal;
            _Supplier_Info.State_Province = State_Province;
            _Supplier_Info.Phone = Phone;
            _Supplier_Info.City = City;
            _Supplier_Info.Country = Country;
            _Supplier_Info.Fax = Fax;
            _Supplier_Info.ST_Reg = ST_Reg;
            _Supplier_Info.STRegNTA = STRegNTA;
            _Supplier_Info.CreatedBy = Session["User"].ToString();

            return Supplier_Info_DA.Insert(_Supplier_Info);
        }
Ejemplo n.º 9
0
        void Accept()
        {
            try
            {
                if (!CheckValidate_F())
                {
                    return;
                }
                Supplier_Controller _Supplier_Controller = new Supplier_Controller();

                if (c_type == Convert.ToInt16(Form_Type.Insert))
                {
                    MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn thêm mới nhà cung cấp hay không?", "Thông báo", NoteBoxLevel.Question);
                    if (MessageBoxResult.Yes == result)
                    {
                        Supplier_Info _Supplier_Info = new Supplier_Info();
                        _Supplier_Info.Supplier_Name = txtName.Text;
                        _Supplier_Info.Phone         = txtPhone.Text;
                        _Supplier_Info.Address       = txtAddress.Text;

                        decimal _id = 0;

                        if (_Supplier_Controller.Supplier_Insert(_Supplier_Info, ref _id))
                        {
                            NoteBox.Show("Thêm mới thành công");
                            c_id_insert = _id;
                            this.Close();
                        }
                        else
                        {
                            NoteBox.Show("Có lỗi trong quá trình thêm mới", "", NoteBoxLevel.Error);
                        }
                    }
                }
                else
                {
                    MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn cập nhật hay không?", "Thông báo", NoteBoxLevel.Question);
                    if (MessageBoxResult.Yes == result)
                    {
                        Supplier_Info _Supplier_Info = new Supplier_Info();
                        _Supplier_Info.Supplier_Name = txtName.Text;
                        _Supplier_Info.Phone         = txtPhone.Text;
                        _Supplier_Info.Address       = txtAddress.Text;

                        if (_Supplier_Controller.Supplier_Update(c_Supplier_Info.Supplier_Id, _Supplier_Info))
                        {
                            NoteBox.Show("Cập nhật dữ liệu thành công");
                            c_id_insert = 1;
                            this.Close();
                        }
                        else
                        {
                            NoteBox.Show("Có lỗi trong quá trình cập nhật dữ liệu", "", NoteBoxLevel.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }