private void StoreGetOuts_Load(object sender, EventArgs e)
        {
            SetComponentsByPermisions();

            this.sgoSearch = new StoreGetOut();
            this.sgoUpdate = new StoreGetOut();

            //cbDepartment
            this.deDepartments = Department.GetDepartments(this.cnConnection);
            this.cbDepartments.Items.Add("");
            foreach (Department deDepartment in this.deDepartments)
            {
                this.cbDepartments.Items.Add(deDepartment.strName);
            }

            //Store Department
            if (this.emLogined.intDepartment == 6)
            {
                this.cbDepartments.Visible = true;
                this.labDepartment.Visible = true;
            }
            else
            {
                this.cbDepartments.SelectedItem = Department.GetNameByNumber(this.cnConnection, this.emLogined.intDepartment);
                this.cbDepartments.Visible      = false;
                this.labDepartment.Visible      = false;
            }
        }
        private void BtmConfirm_Click(object sender, EventArgs e)
        {
            int intSelectedRows = 0;

            foreach (DataRow drStoreGetOut in this.dtStoreGetOuts.Rows)
            {
                if ((Boolean)drStoreGetOut["bitSelect"])
                {
                    ++intSelectedRows;
                }
            }

            if (intSelectedRows > 0)
            {
                DialogResult dialogResult = MessageBox.Show("آیا می خواهید " + intSelectedRows.ToString() + " درخواست را تایید کنید؟", "تایید", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    this.btmDelete.Enabled = false;

                    StoreGetOut.ConfirmByDepartmentSupervisor(this.cnConnection, this.dtStoreGetOuts, this.emLogined.strCoID);

                    this.btmDelete.Enabled = true;
                }

                SearchRequests();
            }
            else
            {
                MessageBox.Show(".هیچ درخواستی انتخاب نشده است", "هشدار", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
            }
        }
        private void btmDelete_Click(object sender, EventArgs e)
        {
            Int16 intSelectedRequests = 0;

            foreach (DataRow drVendor in this.dtStoreGetOuts.Rows)
            {
                if ((Boolean)drVendor["bitSelect"])
                {
                    ++intSelectedRequests;
                }
            }

            if (intSelectedRequests > 0)
            {
                DialogResult dialogResult = MessageBox.Show("آیا می خواهید " + intSelectedRequests.ToString() + " درخواست را حذف کنید؟", "حذف", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    this.btmDelete.Enabled = false;

                    StoreGetOut.DeleteStoreGetOuts(this.cnConnection, this.dtStoreGetOuts);

                    this.btmDelete.Enabled = true;
                }

                SearchRequests();
            }
            else
            {
                MessageBox.Show(".هیچ درخواست انتخاب نشده است", "هشدار", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
            }
        }
Beispiel #4
0
        public StoreGetOutItems()
        {
            InitializeComponent();

            this.sgoStoreGetOut = new StoreGetOut();
            this.sgoiSearch     = new StoreGetOutItem();
            this.sgoiUpdate     = new StoreGetOutItem();


            this.bolEnableBtmDeleteByInterface = false;
            this.bolEnableBtmDeleteByPermision = false;
            this.bolEnableBtmInsertByInterface = true;
            this.bolEnableBtmInsertByPermision = false;
        }
        public void SearchRequests()
        {
            this.sgoSearch = new StoreGetOut();
            DateTime dtFromLoc = new DateTime();
            DateTime dtToLoc   = new DateTime();

            if (this.tbNumber.Text.Trim().Length != 0)
            {
                this.sgoSearch.intNumber = int.Parse(this.tbNumber.Text.Trim());
            }
            if (this.cbDepartments.SelectedIndex >= 1)
            {
                this.sgoSearch.intDepartment = this.deDepartments[this.cbDepartments.SelectedIndex - 1].intNumber;
            }

            if (this.cbDate.Checked)
            {
                dtFromLoc = this.dtpFrom.Value;
                dtToLoc   = this.dtpTo.Value;
            }

            this.dtStoreGetOuts = StoreGetOut.GetStoreGetouts(this.cnConnection, this.sgoSearch, dtFromLoc, dtToLoc);

            this.dgvStoreGetOuts.DataSource = this.dtStoreGetOuts;

            for (int i = 0; i < this.dtStoreGetOuts.Rows.Count; ++i)
            {
                this.dgvStoreGetOuts.Rows[i].Cells["intDepartmentAsName"].Value =
                    Department.GetNameByNumber(this.cnConnection, (int)this.dgvStoreGetOuts.Rows[i].Cells["intDepartment"].Value);

                SubDepartment sdSubDepartment = new SubDepartment();
                sdSubDepartment.intDepartmnt = (int)this.dgvStoreGetOuts.Rows[i].Cells["intDepartment"].Value;
                sdSubDepartment.intNumber    = (int)this.dgvStoreGetOuts.Rows[i].Cells["intNumber"].Value;
                this.dgvStoreGetOuts.Rows[i].Cells["intSubDepartmentAsName"].Value =
                    SubDepartment.GetNameByNumber(this.cnConnection, sdSubDepartment.intDepartmnt, sdSubDepartment.intNumber);

                this.dgvStoreGetOuts.Rows[i].Cells["nvcRequesterCoIDAsName"].Value =
                    Employee.GetNameByCoID(this.cnConnection, this.dgvStoreGetOuts.Rows[i].Cells["nvcRequesterCoID"].Value.ToString());

                this.dgvStoreGetOuts.Rows[i].Cells["nvcDepartmentSupervisorCoIDAsName"].Value =
                    Employee.GetNameByCoID(this.cnConnection, this.dgvStoreGetOuts.Rows[i].Cells["nvcDepartmentSupervisorCoID"].Value.ToString());

                this.dgvStoreGetOuts.Rows[i].Cells["nvcStoreSupervisorCoIDAsName"].Value =
                    Employee.GetNameByCoID(this.cnConnection, this.dgvStoreGetOuts.Rows[i].Cells["nvcStoreSupervisorCoID"].Value.ToString());
            }
        }
Beispiel #6
0
        public StoreGetOutInsert()
        {
            InitializeComponent();

            this.sgoInsert = new StoreGetOut();
        }
        public StoreGetOutUpdate()
        {
            InitializeComponent();

            this.sgoUpdate = new StoreGetOut();
        }