Esempio n. 1
0
        protected void btnInsert_Click(object sender, EventArgs e)
        {
            IncomeDTO idto = new IncomeDTO();
            int idgdv = int.Parse(drDSGDV.SelectedItem.Value.ToString());
            idto.MaGDV = idgdv;
            string thamchieu = drDSClaimInvoice.SelectedItem.ToString();
            bool kttrung = idao.KiemTraTrung(thamchieu, idgdv);

            int maInvoice = int.Parse(drDSClaimInvoice.SelectedItem.Value.ToString());
            idto.MaInvoice = maInvoice;
            idto.MaClaim = thamchieu;
            float feeissue = float.Parse(txtPhiCG.Text);
            idto.IssueFee = feeissue;
            float feereal = float.Parse(txtPhiTT.Text);
            idto.RealFee = feereal;
            float percentage = feereal / feeissue;
            idto.Percentage = percentage;
            float magicincome = ts.CyberIncomeGDV(thamchieu, idgdv);
            idto.CyberIncome = magicincome;
            float realincome = percentage * magicincome / 4;
            idto.RealIncome = realincome;
            if (kttrung == false)
            {
                bool kq = idao.Insert(idto);
                if (kq == true)
                    loadIncomeClaim(thamchieu);
                lblThongBao.Text = "";
            }
            else
                lblThongBao.Text = "It was exist!";
        }
Esempio n. 2
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            InvoiceDTO invdto = new InvoiceDTO();
            invdto.MaClaim = txtId_claim.Text;
            invdto.NoInvoice = txtInvoice.Text;
            invdto.GrandTotal = float.Parse(txtTongTien.Text);
            invdto.DateIssue = DateTime.Parse(txtIssueDate.Text);
            bool kq = inv.Insert(invdto);
            if (kq == true)
            {
                IncomeDTO idto = new IncomeDTO();
                //int idgdv = int.Parse(drDSGDV.SelectedItem.Value.ToString());
                int idgdv = 0;

                //idto.MaGDV = 0;
                string thamchieu = txtId_claim.Text;
                //bool kttrung = idao.KiemTraTrung(thamchieu, idgdv);
                DataTable dt = ts.ListIDGDV(thamchieu);
                List<string> ListID = new List<string>();
                if(dt.Rows.Count>0)
                {
                    //foreach (DataRow dr in dt.Rows)
                    for(int t=0;t<dt.Rows.Count;t++)
                    {
                        ListID.Add(dt.Rows[t][0].ToString());
                    }
                }
                //int maLA = int.Parse(ListID[0].ToString());

                //foreach (DataRow ID_GDV in ListID)
                for(int i=0; i<ListID.Count; i++)
                {
                    //Response.Write("<script>alert('" + ListID[i].ToString()+ "');</script>");
                    idgdv = int.Parse(ListID[i].ToString());
                    idto.MaGDV = idgdv;
                    int maInvoice = inv.SelectMaMax();
                    idto.MaInvoice = maInvoice;
                    idto.MaClaim = thamchieu;
                    float feeissue = float.Parse(txtIssueFee.Text);
                    idto.IssueFee = feeissue;
                    float feereal = float.Parse(txtRealfee.Text);
                    idto.RealFee = feereal;
                    float percentage = feereal / feeissue;
                    idto.Percentage = percentage;
                    float magicincome = ts.CyberIncomeGDV(thamchieu, idgdv);
                    idto.CyberIncome = magicincome;
                    float realincome = percentage * magicincome / 4;
                    idto.RealIncome = realincome;
                    bool them = ic.Insert(idto);
                }
                Session["ThamChieu"] = thamchieu;
                Response.Redirect("~/Pages/detailincome.aspx");
            }
        }
Esempio n. 3
0
 public bool Insert(IncomeDTO i)
 {
     string sql = "sp_Income_Insert";
     List<SqlParameter> ds = new List<SqlParameter>();
     ds.Add(new SqlParameter("@id_invoice",i.MaInvoice));
     ds.Add(new SqlParameter("@issuefee",i.IssueFee));
     ds.Add(new SqlParameter("@realfee",i.RealFee));
     ds.Add(new SqlParameter("@percentage",i.Percentage));
     ds.Add(new SqlParameter("@cyberincome",i.CyberIncome));
     ds.Add(new SqlParameter("@realincome",i.RealIncome));
     ds.Add(new SqlParameter("@id_gdv",i.MaGDV));
     bool kq = false;
     kq= SqlDataAcessHelper.exNonStoreParas(sql, ds);
     return kq;
 }