예제 #1
0
        public InsuranceTypeData load()
        {
            InsuranceTypeData ds = new InsuranceTypeData();

            dp.loadToDataSet(InsuranceTypeData.InsuranceType_TABLE, ds);
            fillRadif(ds);
            return(ds);
        }
예제 #2
0
        public InsuranceTypeData userLimitedList(int userId)
        {
            InsuranceTypeData dataSet = new InsuranceTypeData();
            string            query   = "SELECT * " +
                                        " FROM         dbo.INSURANCETYPE a" +
                                        " WHERE     (ID IN" +
                                        " (SELECT     insurancetypecode " +
                                        " FROM         INSURANCETYPEPERM " +
                                        " WHERE     usercode = " + userId + " ))";

            dp.executeSelect(query, dataSet, InsuranceTypeData.InsuranceType_TABLE);
            return(dataSet);
        }
예제 #3
0
        private void lstUserList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstUserList.SelectedIndex < 0)
            {
                return;
            }

            ComboBoxItem item = (ComboBoxItem)lstUserList.Items[lstUserList.SelectedIndex];

            InsuranceTypeData insTypeDataSet = _insuranceTypeBS.userLimitedList((int)item.Value);

            lstUserInsuranceTypes.DataSource    = insTypeDataSet.Tables[InsuranceTypeData.InsuranceType_TABLE];
            lstUserInsuranceTypes.DisplayMember = InsuranceTypeData.InsuranceCaption_FIELD;
            lstUserInsuranceTypes.ValueMember   = InsuranceTypeData.InsuranceId_FIELD;
        }
예제 #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            InsuranceTypeBS isb   = new InsuranceTypeBS();
            string          idStr = _gridTools.getCurrentRowValue(InsuranceTypeData.InsuranceId_FIELD) + "";

            if (idStr == null || idStr.Length <= 0)
            {
                return;
            }
            DialogResult dr = MessageBox.Show("آیا مایلید حذف کنید ؟", "", MessageBoxButtons.YesNo);

            if (dr.Equals(DialogResult.Yes))
            {
                int id = int.Parse(idStr);
                InsuranceTypeData inData = new InsuranceTypeData();
                int n = isb.delete(id);
                if (n == 0) // there is an error in deleting
                {
                    MessageBox.Show("امکان حذف این مقدار وجود ندارد");
                }
                emptyForm();
                fillGrid();
            }
        }
예제 #5
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int id = -1;

            if (dataGridView1.RowCount <= 0)
            {
                dataMode = NEW_MODE;
            }
            if (!dataMode.Equals(NEW_MODE))
            {
                id = int.Parse(_gridTools.getCurrentRowValue(InsuranceTypeData.InsuranceId_FIELD) + "");
            }

            string caption = _gridTools.getCurrentRowValue(InsuranceTypeData.InsuranceCaption_FIELD) + "";


            InsuranceTypeBS isb        = new InsuranceTypeBS();
            string          strCaption = this.txtInsuranceType.Text;

            if (strCaption.Trim().Length <= 0)
            {
                txtInsuranceType.Focus();
                MessageBox.Show("لطفا یک مقدار برای نوع بیمه وارد کنید");
                return;
            }
            string str = this.cmbDaysBeforExp.Text;
            int    d   = 0;

            if (str.Trim().Length <= 0)
            {
                cmbDaysBeforExp.Focus();
                MessageBox.Show("لطفا یک مقدار برای نوع بیمه وارد کنید");
                return;
            }
            try
            {
                d = int.Parse(str);
            }
            catch (Exception ex)
            {
                cmbDaysBeforExp.Focus();
                MessageBox.Show("عدد وارد شده برای روز صحیح نیست");
                return;
            }

            string            colorStr = ColorTranslator.ToHtml(pnlColor.BackColor);
            InsuranceTypeData inData   = new InsuranceTypeData();
            DataRow           dr       = inData.Tables[InsuranceTypeData.InsuranceType_TABLE].NewRow();

            dr[InsuranceTypeData.InsuranceCaption_FIELD]   = strCaption;
            dr[InsuranceTypeData.DAYSBEFOREXP_FIELD]       = d;
            dr[InsuranceTypeData.InsuranceId_FIELD]        = id;
            dr[InsuranceTypeData.INSURANCETYPECOLOR_FIELD] = colorStr;

            inData.Tables[InsuranceTypeData.InsuranceType_TABLE].Rows.Add(dr);
            if (dataMode.Equals(NEW_MODE))
            {
                isb.add(inData);
            }
            else if (dataMode.Equals(EDIT_MODE))
            {
                isb.update(inData);
            }

            dataMode = EDIT_MODE;
            btnRefresh_Click(null, null);
            fillGrid();
        }
예제 #6
0
 public int update(InsuranceTypeData dataSet)
 {
     return(dp.update(dataSet, InsuranceTypeData.InsuranceType_TABLE));
 }
예제 #7
0
 public int add(InsuranceTypeData dataSet)
 {
     return(dp.add(dataSet, InsuranceTypeData.InsuranceType_TABLE));
 }
예제 #8
0
 public int update(InsuranceTypeData dataSet)
 {
     return(_insuranceTypeDAL.update(dataSet));
 }
예제 #9
0
 public int add(InsuranceTypeData dataSet)
 {
     _insuranceTypeDAL.add(dataSet);
     return(0);
 }