Beispiel #1
0
        public ActionResult Recharge(SoTien so_tien)
        {
            string mesg;

            if (Session[CommonConstants.USER_SESSION] == null)
            {
                mesg        = "Bạn cần đăng nhập.";
                ViewBag.mes = mesg;
                return(View());
            }
            var userSession = (UserLogin)Session[CommonConstants.USER_SESSION];

            var user = new UserDao().GetByUserName(userSession.UserName);
            var res  = new UserDao().recharge(user.ID, so_tien.money);

            if (res)
            {
                mesg = "Nạp thành công";
            }
            else
            {
                mesg = "Nạp thất bại.";
            }
            ViewBag.mes = mesg;
            return(View());
        }
        protected void grdTheoDoiTienCODGiaTri_ClickDup(object sender, DirectEventArgs e)
        {
            string json = e.ExtraParams["ValuesGT"];

            if (json == "")
            {
                return;
            }
            Dictionary <string, string>[] companies = JSON.Deserialize <Dictionary <string, string>[]>(json);
            string   _MaBuuCuc = "0";
            DateTime _TuNgay = DateTime.Now, _DenNgay = DateTime.Now;
            Double   _ST = 0;

            foreach (Dictionary <string, string> row in companies)
            {
                try
                {
                    _MaBuuCuc = row["Ma"];
                    _TuNgay   = DateTime.Parse(row["TuNgay"]);
                    _DenNgay  = DateTime.Parse(row["DenNgay"]);
                    _ST       = Convert.ToDouble(row["GiaTri"]);
                }
                catch
                {
                    _MaBuuCuc = "0";
                }
            }

            if (_MaBuuCuc != "0")
            {
                string _url;
                _url = UIHelper.daPhien.LayDiaChiURL("/TienCOD/frmTheoDoiTienCODGiaTri_CTiet.aspx?gtTuNgay=" + _TuNgay.ToShortDateString() + "&&gtDenNgay=" + _DenNgay.ToShortDateString() + "&&gtMaDonVi=" + _MaBuuCuc + "&&gtSoTien=" + SoTien.ToString() + "&&gtGiaTri=" + _ST.ToString());
                string script = "window.open('" + _url + "', '')";
                this.grdTheoDoiTienCODGiaTri.AddScript(script);
            }
        }
        public static string txtVND(Decimal BaoNhieu)
        {
            string KetQua = "", SoTien, Nhom, Chu, Dich, S1, S2, S3;
            int    S;
            int    I, J, Vitri;

            if (BaoNhieu == 0)
            {
                KetQua = "Không đồng";
            }
            else
            {
                SoTien = Math.Abs(BaoNhieu).ToString("##############0.00");
                SoTien = "               " + SoTien;
                SoTien = SoTien.Substring(SoTien.Length - 18, 18);
                string[] Hang;
                Hang = new string[] { "None", "trăm", "mươi", "gì đó" };
                string[] Doc;
                Doc = new string[] { "None", "ngàn tỷ", "tỷ", "triệu", "ngàn", "đồng" };
                string[] Dem;
                Dem = new string[] { "None", "một", "hai", "ba", "bốn", "năm", "sáu", "bẩy", "tám", "chín" };

                for (I = 1; I <= 5; I++)
                {
                    Nhom = SoTien.Substring(I * 3 - 3, 3);
                    if (Nhom != "   ")
                    {
                        switch (Nhom)
                        {
                        case "000":
                        {
                            if (I == 5)
                            {
                                Chu = "đồng" + " ";
                            }
                            else
                            {
                                Chu = "";
                            }
                            break;
                        }

                        case ".00":
                        {
                            Chu = "chẵn";
                            break;
                        }

                        default:
                        {
                            S1      = Nhom.Substring(0, 1);
                            S2      = Nhom.Substring(1, 1);
                            S3      = Nhom.Substring(Nhom.Length - 1, 1);
                            Chu     = "";
                            Hang[3] = Doc[I];
                            for (J = 1; J <= 3; J++)
                            {
                                Dich = "";
                                try
                                {
                                    S = Convert.ToInt32(Nhom.Substring(J - 1, 1));
                                    if (S > 0)
                                    {
                                        Dich = Dem[S] + " " + Hang[J] + " ";
                                    }
                                    switch (J)
                                    {
                                    case 2:
                                    {
                                        if (S == 1)
                                        {
                                            Dich = "mười" + " ";
                                        }
                                        if ((S == 0) && (S3 != "0"))
                                        {
                                            if ((Convert.ToInt32(S1) >= 1 && Convert.ToInt32(S1) <= 9) || (S1 == "0" && I == 4))
                                            {
                                                Dich = "lẻ" + " ";
                                            }
                                        }
                                        break;
                                    }

                                    case 3:
                                    {
                                        if ((S == 0) && (Nhom != " " + "0"))
                                        {
                                            Dich = Hang[J] + " ";
                                        }

                                        if ((S == 5) && (S2 != "") && (S2 != "0"))
                                        {
                                            Dich = "l" + Dich.Substring(1);
                                        }
                                        break;
                                    }
                                    }
                                    Chu = Chu + Dich;
                                }
                                catch (Exception)
                                {
                                }
                            }

                            break;
                        }
                        }
                        //Vitri = Chu.IndexOf("mươi một", 1);
                        KetQua = KetQua + Chu;
                        string d = KetQua[0].ToString().ToUpper();

                        string d1 = KetQua.Remove(0, 1);
                        string k  = d1.Insert(0, d);
                        KetQua = k;
                    }
                }
            }
            return(KetQua);
        }
 public override string ToString()
 {
     return(string.Format("LH{0} - Môn học: {1} - Ca: {2} - Ngày học: {3} - Số lượng HV: {4} - Số tiền: {5} VNĐ", MaLH.ToString(), MonHocBUS.Instance.getMonHoc((int)MonHoc).TenMH, CaHoc, NgayHoc, SoLuongHV, SoTien.ToString()));
 }