public int UpdateVIPPrasadam(VIPPrasadam vObj)
 {
     using (var db = new eTempleDbDB())
     {
         return db.Update(vObj);
     }
 }
 public int SaveVIPPrasadam(VIPPrasadam vObj)
 {
     var savedTokens = new List<VIPPrasadam>();
     using (var db = new eTempleDbDB())
     {
         db.Save(vObj);
         return vObj.Id;
     }
 }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            var sdDao = new StockDetailsDao();
            int serviceId = (cmbServiceID.SelectedItem as Service).Id;
            string serviceName = (cmbServiceID.SelectedItem as Service).Name;
            int stockVal = Convert.ToInt32(numQty.Text) - ActualStock;
            //stockVal = -(stockVal);
            sdDao.UpdateStockDetail(stockVal, serviceId);

            int poId = 0;
            int.TryParse(txtId.Text, out poId);

            int cUser = (cmbReferenceBy.SelectedItem as Employee).Id;

            var poObj = new VIPPrasadam
            {
                Id = poId,
                ServiceId = (cmbServiceID.SelectedItem as Service).Id,
                VIPName = txtVIPName.Text,
                Phone = txtPhone.Text,
                ReferenceBy = cUser,
                Qty = Convert.ToInt32(numQty.Text),
                VisitedDate = Convert.ToDateTime(dtVisitedDate.Value),
                IssuedBy = App.LoggedInEmployee.Id
            };

            var poDao = new VIPPrasadamDao();
            int tokenId = poDao.SaveVIPPrasadam(poObj);

            var savedTokens = new List<VIPPrasadam>();

            poObj = poDao.getTokenById(tokenId);
            savedTokens.Add(poObj);
            ShowVIPPrasadam();
            PrintTokens2(savedTokens);
        }
 private void ShowVIP(VIPPrasadam poObj)
 {
     txtId.Text = poObj.Id.ToString();
     txtVIPName.Text = poObj.VIPName;
     txtPhone.Text = poObj.Phone;
     cmbReferenceBy.SelectedValue = poObj.ReferenceBy;
     cmbServiceID.SelectedValue = poObj.ServiceId;
     numQty.Value = poObj.Qty;
     ActualStock = poObj.Qty;
     dtVisitedDate.Value = Convert.ToDateTime(poObj.VisitedDate);
 }
        private string RenderToken2(VIPPrasadam token)
        {
            var sb = new StringBuilder();
            string line = string.Empty;
            /*
            sb.AppendLine();
            sb.AppendLine();
            sb.AppendLine();
            */
            sb.AppendLine();
            sb.AppendLine(_rulerLine);
            line = string.Format("  Sl No : {0}", token.Id).PadRight(_lineWidth / 2);
            sb.AppendLine(line);

            line = string.Format("Date : {0:dd/MM/yyyy h:mm tt}  ", token.VisitedDate).PadLeft(_lineWidth / 2);
            sb.AppendLine(line);

            sb.AppendLine(_rulerLine);

            if (token.ServiceName != "")
            {
                line = string.Format(" Purpose : {0}", token.ServiceName).PadRight(_lineWidth);
                sb.AppendLine(line);
            }

            if (token.VIPName != "")
            {
                line = string.Format("{0}", token.VIPName).PadRight(_lineWidth);
                sb.AppendLine(line);
            }

            sb.AppendLine(_rulerLine);

            line = string.Format(" Qty : {0}", token.Qty).PadRight(_lineWidth / 2);
            sb.AppendLine(line);

            sb.AppendLine(_rulerLine);
            sb.AppendLine();

            line = string.Format("Issued by : {0}", App.LoggedInEmployee.Name);
            sb.AppendLine(line);

            return sb.ToString();
        }