Пример #1
0
        // <summary>
        /// Thêm mới kiểu hợp đồng
        /// </summary>
        public void AddContractType()
        {
            DataRow dr = dtContractType.NewRow();

            dtContractType.Rows.Add(SetData(dr));

            int ret = 0;

            try
            {
                ret = contractDO.AddContractTypeDO(dsContractType);
            }
            catch
            {
            }
            if (ret == 1)
            {
                string str  = WorkingContext.LangManager.GetString("frmContract_Them_Messa1");
                string str1 = WorkingContext.LangManager.GetString("frmContract_Them_Title");
                //MessageBox.Show("Đã tồn tại tên kiểu hợp đồng !", "Thêm kiểu hợp đồng", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dsContractType.RejectChanges();
            }
            if (ret == 2)
            {
                string str  = WorkingContext.LangManager.GetString("frmContract_Them_Messa2");
                string str1 = WorkingContext.LangManager.GetString("frmContract_Them_Title");
                //MessageBox.Show("Đã thêm kiểu hợp đồng thành công.", "Thêm kiểu hợp đồng", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Information);
                dsContractType.AcceptChanges();
                this.Close();
//				ClearFormData();
            }
            if (ret == 0)
            {
                string str  = WorkingContext.LangManager.GetString("frmContract_Them_Messa3");
                string str1 = WorkingContext.LangManager.GetString("frmContract_Them_Title");
                //MessageBox.Show("Có lỗi xảy ra. Thêm kiểu hợp đồng thất bại !", "Thêm kiểu hợp đồng", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dsContractType.RejectChanges();
            }
        }