예제 #1
0
        private void CustomerHteNumber()
        {
            string    DownloadedDate = "";
            int       ShopID         = Convert.ToInt32(Session["CurrentUserID"]);
            DataTable dt             = db.getAllByQuery("select No,Date from HteNumber where ShopID=" + ShopID + " and MONTH(Date) = MONTH(GetDate())AND YEAR(Date) = YEAR(GetDate())");//your datatable
            string    attachment     = "attachment; filename=လကုန္​ထိုးထား​ေသာစာရင္​း.txt";

            Response.Buffer = true;
            Response.ClearContent();
            Response.AddHeader("content-disposition", attachment);
            Response.ContentType = "text/plain";

            string tab = "\t"; string newline = "\r\n";

            Response.Write("စဥ္​" + tab);
            Response.Write("ထီနံပါတ္" + newline);

            int i = 1;

            foreach (DataRow row in dt.Rows)
            {
                tab = "\t";
                Response.Write(i);
                Response.Write(tab);
                Response.Write(row["No"].ToString());
                DownloadedDate = row["Date"].ToString();
                Response.Write(newline);
                i++;
            }
            Response.Write(DownloadedDate);
            Response.End();
        }
예제 #2
0
        public string SendSeatInfo(String TicketID, String Name, String User, String Phone, String SeatName, String Date, String Time)
        {
            string    SMSStatus = "NotOK";
            DataTable dt        = d.getAllByQuery("select * from SMSGateway");

            foreach (DataRow row in dt.Rows)
            {
                string IP = row["IP"].ToString();
                IP   = IP.Replace(" ", string.Empty);
                Date = Date.Replace("/", "-");

                string Number  = Phone;
                string Message = Name + "/" + SeatName + "[" + TicketID + "]" + "/" + Date + " " + Time;

                string all = IP + "v1/sms/send/?phone=" + Number + "&message=" + Message;

                WebRequest request = WebRequest.Create(all);
                try
                {
                    WebResponse response = request.GetResponse();
                    ViewData["status"] = ((HttpWebResponse)response).StatusCode;
                    if (ViewData["status"].ToString() == "OK")
                    {
                        SMSStatus = "OK";
                        break;
                    }
                }
                catch
                {
                    continue;
                }
            }

            return(SMSStatus);
        }
예제 #3
0
        public ActionResult ProcessDifferentHteRecordSellForm()
        {
            if (Session["CurrentUserID"] == null)
            {
                Response.Redirect("~/Login/LoginForm");
            }
            int    DifferentHteID = Convert.ToInt32(Request.Form["DifferentHteID"]);
            string Name           = Request.Form["Name"];
            string Phone          = Request.Form["Phone"];
            string Address        = Request.Form["Address"];

            int ShopID    = Convert.ToInt32(Session["CurrentUserID"]);
            int HteTypeID = Convert.ToInt32(Session["HteTypeID"]);

            Phone = Phone.Replace("၀", "0");
            Phone = Phone.Replace("၁", "1"); Phone = Phone.Replace("၂", "2"); Phone = Phone.Replace("၃", "3"); Phone = Phone.Replace("၄", "4");
            Phone = Phone.Replace("၅", "5"); Phone = Phone.Replace("၆", "6"); Phone = Phone.Replace("၇", "7"); Phone = Phone.Replace("၈", "8");
            Phone = Phone.Replace("၉", "9");

            //Insert into Customer
            db.ChangeByQuery("insert into Customer values(" + ShopID + ",N'" + Name + "','" + Phone + "',N'" + Address + "','" + DateTime.Now.ToString("MM.dd.yyyy") + "'," + HteTypeID + ")");
            int CustomerID = db.getIntByQuery("SELECT * FROM Customer where ShopID=" + ShopID + " ORDER BY ID ASC", "ID");

            int CostPrice = db.getIntByQuery("select * from HteAttribute where HteTypeID=" + HteTypeID + " and ShopID=" + ShopID, "CostPrice");
            int Profit    = db.getIntByQuery("select * from HteAttribute where HteTypeID=" + HteTypeID + " and ShopID=" + ShopID, "SellingPrice") - CostPrice;

            DataTable dbDifferntHteNo = db.getAllByQuery("select * from DifferentHteNo where DifferentHteID=" + DifferentHteID + " and ShopID=" + ShopID);

            foreach (DataRow rows in dbDifferntHteNo.Rows)
            {
                string No = rows["No"].ToString();
                db.ChangeByQuery("insert into HteNumber values(" + ShopID + "," + CustomerID + ",N'" + No + "','" + DateTime.Now.ToString("MM.dd.yyyy") + "'," + HteTypeID + "," + Profit + "," + CostPrice + ")");
                db.ChangeByQuery("update HteAttribute set Quantity = Quantity-1 where ShopID=" + ShopID + " and HteTypeID=" + HteTypeID);

                db.ChangeByQuery("delete from DifferentHteNo where ID=" + Convert.ToInt32(rows["ID"]));
            }
            db.ChangeByQuery("delete from DifferentHte where ID=" + DifferentHteID);

            return(RedirectToAction("ViewTodayCustomer", "Shop"));
        }
예제 #4
0
        public ActionResult DeleteAccount()
        {
            int       EOrgID  = Convert.ToInt32(Request.QueryString["EOrgID"]);
            DataTable dtEvent = db.getAllByQuery("select * from Event where EOrgID=" + EOrgID);

            foreach (DataRow row in dtEvent.Rows)
            {
                int ID = Convert.ToInt32(row["ID"]);
                //(1) Delete Event, Row, Seat, CustomerTicket
                db.ChangeByQuery("delete from CustomerTicket where SeatID in(select ID from Seat where EID=" + ID + ")");
                db.ChangeByQuery("delete from Seat where EID=" + ID);
                db.ChangeByQuery("delete from Row where EID=" + ID);
                db.ChangeByQuery("delete from Event where ID=" + ID);
            }
            db.ChangeByQuery("delete from Login where AllID=" + EOrgID + " and AccessLevel=2");
            db.ChangeByQuery("delete from EOrg where ID=" + EOrgID);
            return(RedirectToAction("setEventOrgAccount"));
        }
예제 #5
0
        private void DataToExcel()
        {
            DataTable dt         = db.getAllByQuery("select ID,No,Date from HteNumber");//your datatable
            string    attachment = "attachment; filename=download.xls";

            Response.Clear();
            Response.ClearHeaders();
            Response.ClearContent();

            Response.AddHeader("content-disposition", attachment);
            Response.ContentType     = "application/vnd.ms-excel";
            Response.ContentEncoding = System.Text.Encoding.UTF8;

            string tab = "";

            foreach (DataColumn dc in dt.Columns)
            {
                Response.Write(tab + dc.ColumnName);
                tab = "\t";
            }
            Response.Write("\r\n");
            int i;

            foreach (DataRow dr in dt.Rows)
            {
                tab = "";
                for (i = 0; i < dt.Columns.Count; i++)
                {
                    Response.Write(tab + dr[i].ToString());
                    tab = "\t";
                }
                Response.Write("\r\n");
            }

            Response.Flush();
            Response.End();
        }