Beispiel #1
0
        private void judegeSalaryType()
        {
            try
            {
                AddPersonSalary addPersonSalary = new AddPersonSalary();
                addPersonSalary.warehouseId = (int)GlobalData.Warehouse["id"];
                string json = (new JavaScriptSerializer()).Serialize(addPersonSalary);
                string url  = Defines.ServerURL + "/warehouse/" + GlobalData.AccountBook + "/person_salary/judge_salary_type_person";
                IDictionary <string, object> salaryTypePerson = RestClient.RequestPost <IDictionary <string, object> >(url, json);

                if ((int)salaryTypePerson["personId"] != -1)
                {
                    MessageBox.Show($"人员\"{salaryTypePerson["personName"]}\"在多个类型中重复,如果其对应薪资项目名称完全相同,则显示“所有类型”工资时金额可能不准确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (WebException ex)
            {
                string message = ex.Message;
                if (ex.Response != null)
                {
                    message = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
                }
                MessageBox.Show(("刷新") + "失败:" + message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
Beispiel #2
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("将会清空当前期间的所有条目,按上一期间生成,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }
            List <int> ids = new List <int>();
            IDictionary <string, object> rowData;

            for (int i = 0; i < this.model1.RowCount; i++)
            {
                rowData = this.model1.GetRows(new int[] { i })[0];
                ids.Add((int)rowData["id"]);
            }
            AddPersonSalary addPersonSalary = new AddPersonSalary();

            addPersonSalary.personSalaryIds = ids;
            if (GlobalData.SalaryPeriod == null)
            {
                MessageBox.Show($"无薪资期间无法进行添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (GlobalData.SalaryType == null)
            {
                MessageBox.Show($"无薪资类型无法进行添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            addPersonSalary.salaryPeriodId = (int)GlobalData.SalaryPeriod["id"];
            addPersonSalary.warehouseId    = (int)GlobalData.Warehouse["id"];
            string json = (new JavaScriptSerializer()).Serialize(addPersonSalary);

            try
            {
                string body = json;
                string url  = Defines.ServerURL + "/warehouse/" + GlobalData.AccountBook + "/person_salary/add_last_period";
                RestClient.RequestPost <List <IDictionary <string, object> > >(url, body);
                MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Search();
            }
            catch (WebException ex)
            {
                string message = ex.Message;
                if (ex.Response != null)
                {
                    message = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
                }
                MessageBox.Show(("添加") + "失败:" + message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
        private void toolStripButtonAlter_Click(object sender, EventArgs e)
        {
            List <int> typeId = new List <int>();

            for (int i = 0; i < this.model1.RowCount; i++)
            {
                if (this.model1.GetRowSynchronizationState(i) == SynchronizationState.ADDED_UPDATED && this.model1[i, "id"] != null)
                {
                    typeId.Add((int)this.model1[i, "id"]);
                }
            }
            if (typeId.Count == 0)
            {
                return;
            }
            if (this.IsRepeat(typeId.ToArray()))
            {
                MessageBox.Show("添加的类型重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
            }
            AddPersonSalary addPersonSalary = new AddPersonSalary();

            //addPersonSalary.salaryTypeId =typeId;
            addPersonSalary.warehouseId = (int)GlobalData.Warehouse["id"];
            if (GlobalData.SalaryPeriod == null)
            {
                MessageBox.Show("当前仓库无任何区间,无法添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return;
            }
            addPersonSalary.salaryPeriodId = (int)GlobalData.SalaryPeriod["id"];
            string json = (new JavaScriptSerializer()).Serialize(addPersonSalary);

            try
            {
                string body = json;
                string url  = Defines.ServerURL + "/warehouse/" + GlobalData.AccountBook + "/person_salary/add_person_salary_by_salary_type";
                RestClient.RequestPost <List <IDictionary <string, object> > >(url, body);
                MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (WebException ex)
            {
                string message = ex.Message;
                if (ex.Response != null)
                {
                    message = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
                }
                MessageBox.Show(("添加") + "失败:" + message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
Beispiel #4
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("将会刷新公式、计价相关条目,手动修改过的条目,将不会清空,并用于公式计算,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }
            List <int> ids     = new List <int>();
            List <int> typeIds = new List <int>();
            IDictionary <string, object> rowData;

            for (int i = 0; i < this.model1.RowCount; i++)
            {
                rowData = this.model1.GetRows(new int[] { i })[0];
                ids.Add((int)rowData["id"]);
            }
            AddPersonSalary addPersonSalary = new AddPersonSalary();

            addPersonSalary.personSalaryIds = ids;
            if (GlobalData.SalaryPeriod == null)
            {
                MessageBox.Show($"无薪资期间无法进行刷新!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (GlobalData.SalaryType == null)
            {
                MessageBox.Show($"无薪资类型无法进行刷新!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string str = "";

            try { str = (string)this.comboBoxSalaryType.SelectedItem; }
            catch { }
            if (str == "全部类型")
            {
                foreach (IDictionary <string, object> salaryType in GlobalData.AllSalaryType)
                {
                    typeIds.Add((int)salaryType["id"]);
                }
            }
            else
            {
                typeIds.Add((int)GlobalData.SalaryType["id"]);
            }
            addPersonSalary.salaryPeriodId = (int)GlobalData.SalaryPeriod["id"];
            addPersonSalary.salaryTypeIds  = typeIds;
            addPersonSalary.warehouseId    = (int)GlobalData.Warehouse["id"];
            string json = (new JavaScriptSerializer()).Serialize(addPersonSalary);

            try
            {
                string body = json;
                string url  = Defines.ServerURL + "/warehouse/" + GlobalData.AccountBook + "/person_salary/refresh_formula_and_valuation";
                RestClient.RequestPost <List <IDictionary <string, object> > >(url, body);
                MessageBox.Show("刷新成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Search();
            }
            catch (WebException ex)
            {
                string message = ex.Message;
                if (ex.Response != null)
                {
                    message = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
                }
                MessageBox.Show(("刷新公式、计件条目") + "失败:" + message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }