Пример #1
0
        public ActionResult GenerateEpin()
        {
            var model = new eTicket();

            ViewBag.ToMsrno = new SelectList(GetMembers(), "Value", "Text", "");
            model.Nos       = 1;
            return(View(model));
        }
Пример #2
0
        public ActionResult GenerateEpin(eTicket model)
        {
            int            ToMsrno   = model.ToMsrno;
            string         Narration = model.Narration;
            int            Nos       = model.Nos;
            SqlTransaction trans     = fetchdata.GetTrans();
            int            epinNo    = GetMaxEpin();

            for (int i = 1; i <= Nos; i++)
            {
                epinNo = epinNo + 1;
                var ticket = CreateEPin(10);
                ticket = ticket + epinNo.ToString();
                IDbDataParameter[] Insertparam = new[]
                {
                    CreateParameter(DbType.DateTime, 50, "@GenDate", ParameterDirection.Input, DateTime.Now),
                    CreateParameter(DbType.Int32, 100, "@Nos", ParameterDirection.Input, i),
                    CreateParameter(DbType.String, 100, "@UserId", ParameterDirection.Input, gMSRNO),
                    CreateParameter(DbType.String, 50, "@ETicket", ParameterDirection.Input, ticket),
                    CreateParameter(DbType.Int32, 50, "@IsPrint", ParameterDirection.Input, 0),
                    CreateParameter(DbType.Int32, 50, "@IsUsed", ParameterDirection.Input, 0),
                    CreateParameter(DbType.Int32, 50, "@IsCancel", ParameterDirection.Input, 0),
                    CreateParameter(DbType.Int32, 50, "@ItemId", ParameterDirection.Input, PlanID),
                    CreateParameter(DbType.Int32, 50, "@EpinNo", ParameterDirection.Input, epinNo),
                    CreateParameter(DbType.String, 4000, "@Narration", ParameterDirection.Input, Narration),
                    CreateParameter(DbType.String, 5000, "@Transfer", ParameterDirection.Input, ""),
                    CreateParameter(DbType.Int32, 500, "@ToMsrno", ParameterDirection.Input, ToMsrno),
                };
                string cmd = "insert eTicket (GenDate,Nos,UserId,ETicket,IsPrint,IsUsed,IsCancel,ItemId,EpinNo,Narration,Transfer,ToMsrno)values(@GenDate,@Nos,@UserId,@ETicket,@IsPrint,@IsUsed,@IsCancel,@ItemId,@EpinNo,@Narration,@Transfer,@ToMsrno)";
                fetchdata.ExecuteQuery(cmd, Insertparam, trans, CommandType.Text);
            }
            trans.Commit();

            ViewBag.ToMsrno = new SelectList(GetMembers(), "Value", "Text", ToMsrno.ToString());
            return(View(model));
        }