public ActionResult Save(WorkShopGRN model)
 {
     model.OrganizationId = OrganizationId;
     model.CreatedDate    = System.DateTime.Now;
     model.CreatedBy      = UserID.ToString();
     new WorkShopGRNRepository().InsertWorkShopGRN(model);
     return(RedirectToAction("CreateWorkShopGRN"));
 }
        // GET: WorkShopGRN
        public ActionResult CreateWorkShopGRN()
        {
            FillSupplier();
            FillCurrency();
            WorkShopGRN WorkShopGRN = new WorkShopGRN();

            WorkShopGRN.GRNDate = System.DateTime.Today;
            return(View(WorkShopGRN));
        }
        public ActionResult DisplayWGRNList()
        {
            FillItem();
            FillCurrency();
            WorkShopGRN WorkShopGRN = new WorkShopGRN();

            WorkShopGRN.WorkShopGRNItems = new List <WorkShopGRNItem>();
            var item = new WorkShopGRNItem();

            WorkShopGRN.WorkShopGRNItems.Add(item);
            return(PartialView("_DisplayWGRNList", WorkShopGRN));
        }
Example #4
0
        /// <summary>
        /// Insert WorkShop GRN
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        ///

        public int InsertWorkShopGRN(WorkShopGRN model)
        {
            using (IDbConnection connection = OpenConnection(dataConnection))
            {
                IDbTransaction trn = connection.BeginTransaction();
                try
                {
                    int id = 0;

                    string sql = @"insert  into WorkShopGRN(GRNNo,GRNDate,SupplierId,SONoAndDate,CurrencyId,SupplierDCNoAndDate,SpecialRemarks,
                                                Addition,AdditionRemarks,Deduction,DeductionRemarks,GRNTotalAmount,
                                                CreatedBy,CreatedDate,OrganizationId) 

                                        Values (@GRNNo,@GRNDate,@SupplierId,@SONoAndDate,@CurrencyId,@SupplierDCNoAndDate,@SpecialRemarks,
                                                @Addition,@AdditionRemarks,@Deduction,@DeductionRemarks,@GRNTotalAmount,
                                                @CreatedBy,@CreatedDate,@OrganizationId);
                                            SELECT CAST(SCOPE_IDENTITY() as int)";



                    id = connection.Query <int>(sql, model, trn).Single();
                    var saleorderitemrepo = new WorkShopGRNItemRepository();
                    foreach (var item in model.WorkShopGRNItems)
                    {
                        item.WorkShopGRNId = id;
                        new WorkShopGRNItemRepository().InsertWGRNItem(item, connection, trn);
                    }
                    InsertLoginHistory(dataConnection, model.CreatedBy, "Create", "Workshop GRN", id.ToString(), "0");
                    trn.Commit();
                    return(id);
                }
                catch (Exception)
                {
                    trn.Rollback();
                    throw;
                    return(0);
                }
            }
        }