Пример #1
0
        public ActionResult Save(DeliveryChallan model)
        {
            model.OrganizationId = OrganizationId;
            model.CreatedDate    = System.DateTime.Now;
            model.CreatedBy      = UserID.ToString();

            try
            {
                foreach (ItemBatch item in model.ItemBatches)
                {
                    item.WarrantyStartDate  = model.DeliveryChallanDate;
                    item.WarrantyExpireDate = model.DeliveryChallanDate.AddMonths(item.WarrantyPeriodInMonths ?? 0).AddDays(-1);
                }
            }
            catch (NullReferenceException) { }
            string ref_no = new DeliveryChallanRepository().InsertDeliveryChallan(model);

            if (ref_no.Length > 0)
            {
                TempData["success"] = "Saved Successfully. The Reference No. is " + ref_no;
                return(RedirectToAction("Index"));
            }
            else
            {
                EmployeeDropdown();
                TempData["error"] = "Some error occured while saving. Please try again";
                return(View(model));
            }
        }
Пример #2
0
 public object InsertUpdateDeliveryChallan(DeliveryChallan deliveryChallan)
 {
     if (deliveryChallan.DeliveryChallanDetailList.Count > 0)
     {
         deliveryChallan.DetailXML = _commonBusiness.GetXMLfromDeliveryChallanObject(deliveryChallan.DeliveryChallanDetailList, "ProductID,ProductModelID,ProductSpec,UnitCode");
     }
     return(_deliveryChallanRepository.InsertUpdateDeliveryChallan(deliveryChallan));
 }
Пример #3
0
 private void msbTransactions_SP_DCST_Click(object sender, EventArgs e)
 {
     if (childDeliveryChallanForm == null || childDeliveryChallanForm.Text == "")
     {
         childDeliveryChallanForm           = new DeliveryChallan();
         childDeliveryChallanForm.MdiParent = this;
         childDeliveryChallanForm.Show();
     }
 }
Пример #4
0
        public IActionResult DeleteDeliveryChallan(long id)
        {
            DeliveryChallan DeliveryChallan = challan_repo.Find(id);

            if (DeliveryChallan == null)
            {
                return(NotFound());
            }

            challan_repo.Delete(DeliveryChallan);
            return(Ok());
        }
Пример #5
0
        public List <DeliveryChallan> GetDeliveryChallanForSelectList(Guid?id)
        {
            List <DeliveryChallan> deliveryChallanList = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[PSA].[GetDeliveryChallanForSelectList]";
                        cmd.CommandType = CommandType.StoredProcedure;
                        if (id == null)
                        {
                            cmd.Parameters.AddWithValue("@ID", DBNull.Value);
                        }
                        else
                        {
                            cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = id;
                        }
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                deliveryChallanList = new List <DeliveryChallan>();
                                while (sdr.Read())
                                {
                                    DeliveryChallan deliveryChallan = new DeliveryChallan();
                                    {
                                        deliveryChallan.ID            = (sdr["ID"].ToString() != "" ? Guid.Parse(sdr["ID"].ToString()) : deliveryChallan.ID);
                                        deliveryChallan.DelvChallanNo = (sdr["DelvChallanNo"].ToString() != "" ? sdr["DelvChallanNo"].ToString() : deliveryChallan.DelvChallanNo);
                                    }
                                    deliveryChallanList.Add(deliveryChallan);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(deliveryChallanList);
        }
Пример #6
0
 private string GenCN()
 {
     //var context = new ApplicationDbContext();
     try
     {
         //DeliveryChallan lastDeliveryChallan = context.DeliveryChallans.LastOrDefault();
         DeliveryChallan lastDeliveryChallan = challan_repo.GetLast();
         string          value  = lastDeliveryChallan.ChallanNumber;
         string          number = Regex.Match(value, "[0-9]+$").Value;
         return(value.Substring(0, value.Length - number.Length) +
                (long.Parse(number) + 1).ToString().PadLeft(number.Length, '0'));
     }
     catch (NullReferenceException)
     {
         return("DCN0000000000001");
     }
 }
Пример #7
0
 public ActionResult Edit(DeliveryChallan model)
 {
     try
     {
         model.CreatedBy = UserID.ToString(); model.CreatedDate = DateTime.Today; model.OrganizationId = OrganizationId;
         new DeliveryChallanRepository().UpdateDeliveryChallan(model);
         TempData["success"]        = "Updated Successfully (" + model.DeliveryChallanRefNo + ")";
         TempData["JobCardQCRefNo"] = model.DeliveryChallanRefNo;
         return(RedirectToAction("DeliveryChallanList"));
     }
     catch (Exception)
     {
         TempData["error"] = "Some error occurred. Please try again.";
     }
     EmployeeDropdown();
     return(View(model));
 }
Пример #8
0
        public ActionResult Edit(int id = 0)
        {
            try
            {
                if (id != 0)
                {
                    EmployeeDropdown();
                    DeliveryChallan DeliveryChallan = new DeliveryChallan();
                    DeliveryChallan                   = new DeliveryChallanRepository().ViewDeliveryChallanHD(id);
                    DeliveryChallan.ItemBatches       = new DeliveryChallanRepository().GetDeliveryChallanDT(id);
                    DeliveryChallan.PrintDescriptions = new DeliveryChallanRepository().GetPrintDescriptions(id);
                    if (DeliveryChallan.PrintDescriptions == null || DeliveryChallan.PrintDescriptions.Count == 0)
                    {
                        DeliveryChallan.PrintDescriptions.Add(new PrintDescription());
                    }
                    return(View(DeliveryChallan));
                }
                else
                {
                    TempData["error"]   = "That was an invalid/unknown request. Please try again.";
                    TempData["success"] = "";
                }
            }
            catch (InvalidOperationException iox)
            {
                TempData["error"] = "Sorry, we could not find the requested item. Please try again.|" + iox.Message;
            }
            catch (SqlException sx)
            {
                TempData["error"] = "Some error occured while connecting to database. Please try again after sometime.|" + sx.Message;
            }
            catch (NullReferenceException nx)
            {
                TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message;
            }
            catch (Exception ex)
            {
                TempData["error"] = "Some error occured. Please try again.|" + ex.Message;
            }

            TempData["success"] = "";
            return(RedirectToAction("Index"));
        }
 private void guna2Button1_Click(object sender, EventArgs e)
 {
     if (DateTime.Now > Program.expdate)
     {
         Trialform tf = new Trialform();
         tf.Show();
     }
     else
     {
         DeliveryChallan BA = new DeliveryChallan();
         BA.TopLevel = false;
         // BA.AutoScroll = true;
         this.Controls.Add(BA);
         BA.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
         BA.Dock            = DockStyle.Fill;
         BA.Visible         = true;
         BA.BringToFront();
     }
 }
Пример #10
0
 public IActionResult UpdateDeliveryChallan([FromBody] DeliveryChallan model)
 {
     challan_repo.Update(model);
     return(new OkObjectResult(new { DeliveryChallanID = model.DeliveryChallanId }));
 }
Пример #11
0
        public object InsertUpdateDeliveryChallan(DeliveryChallan deliveryChallan)
        {
            SqlParameter outputStatus, outputID, outputDelvChallanNo = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[PSA].[InsertUpdateDeliveryChallan]";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@IsUpdate", SqlDbType.Bit).Value                     = deliveryChallan.IsUpdate;
                        cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value              = deliveryChallan.ID;
                        cmd.Parameters.Add("@DelvChallanNo", SqlDbType.VarChar, 20).Value        = deliveryChallan.DelvChallanNo;
                        cmd.Parameters.Add("@DelvChallanRefNo", SqlDbType.VarChar, 20).Value     = deliveryChallan.DelvChallanRefNo;
                        cmd.Parameters.Add("@DelvChallanDate", SqlDbType.DateTime).Value         = deliveryChallan.DelvChallanDateFormatted;
                        cmd.Parameters.Add("@SaleOrderID", SqlDbType.UniqueIdentifier).Value     = deliveryChallan.SaleOrderID;
                        cmd.Parameters.Add("@ProdOrderID", SqlDbType.UniqueIdentifier).Value     = deliveryChallan.ProdOrderID;
                        cmd.Parameters.Add("@CustomerID", SqlDbType.UniqueIdentifier).Value      = deliveryChallan.CustomerID;
                        cmd.Parameters.Add("@PlantCode", SqlDbType.Int).Value                    = deliveryChallan.PlantCode;
                        cmd.Parameters.Add("@PreparedBy", SqlDbType.UniqueIdentifier).Value      = deliveryChallan.PreparedBy;
                        cmd.Parameters.Add("@GeneralNotes", SqlDbType.NVarChar, -1).Value        = deliveryChallan.GeneralNotes;
                        cmd.Parameters.Add("@DocumentOwnerID", SqlDbType.UniqueIdentifier).Value = deliveryChallan.DocumentOwnerID;
                        cmd.Parameters.Add("@BranchCode", SqlDbType.Int).Value                   = deliveryChallan.BranchCode;
                        cmd.Parameters.Add("@DetailXML", SqlDbType.Xml).Value                    = deliveryChallan.DetailXML;
                        cmd.Parameters.Add("@FileDupID", SqlDbType.UniqueIdentifier).Value       = deliveryChallan.hdnFileID;
                        cmd.Parameters.Add("@VehiclePlateNo", SqlDbType.NVarChar, -1).Value      = deliveryChallan.VehiclePlateNo;
                        cmd.Parameters.Add("@DriverName", SqlDbType.NVarChar, -1).Value          = deliveryChallan.DriverName;
                        //-----------------------//
                        cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value = deliveryChallan.PSASysCommon.CreatedBy;
                        cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value    = deliveryChallan.PSASysCommon.CreatedDate;
                        cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = deliveryChallan.PSASysCommon.CreatedBy;
                        cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value    = deliveryChallan.PSASysCommon.CreatedDate;
                        outputStatus           = cmd.Parameters.Add("@Status", SqlDbType.SmallInt);
                        outputStatus.Direction = ParameterDirection.Output;
                        outputID                      = cmd.Parameters.Add("@IDOut", SqlDbType.UniqueIdentifier);
                        outputID.Direction            = ParameterDirection.Output;
                        outputDelvChallanNo           = cmd.Parameters.Add("@DeliveryChallanNoOut", SqlDbType.VarChar, 20);
                        outputDelvChallanNo.Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();
                    }
                }
                switch (outputStatus.Value.ToString())
                {
                case "0":
                    throw new Exception(_appConstant.InsertFailure);

                case "1":
                    deliveryChallan.ID            = Guid.Parse(outputID.Value.ToString());
                    deliveryChallan.DelvChallanNo = outputDelvChallanNo.Value.ToString();
                    return(new
                    {
                        ID = deliveryChallan.ID,
                        DeliveryChallanNo = deliveryChallan.DelvChallanNo,
                        SaleOrderID = deliveryChallan.SaleOrderID,
                        ProdOrderID = deliveryChallan.ProdOrderID,
                        Status = outputStatus.Value.ToString(),
                        Message = deliveryChallan.IsUpdate ? _appConstant.UpdateSuccess : _appConstant.InsertSuccess
                    });

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(new
            {
                ID = deliveryChallan.ID,
                DeliveryChallanNo = deliveryChallan.DelvChallanNo,
                Status = outputStatus.Value.ToString(),
                Message = deliveryChallan.IsUpdate ? _appConstant.UpdateSuccess : _appConstant.InsertSuccess
            });
        }
Пример #12
0
        public List <DeliveryChallan> GetAllDeliveryChallan(DeliveryChallanAdvanceSearch deliveryChallanAdvanceSearch)
        {
            List <DeliveryChallan> deliveryChallanList = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[PSA].[GetAllDeliveryChallan]";
                        if (string.IsNullOrEmpty(deliveryChallanAdvanceSearch.SearchTerm))
                        {
                            cmd.Parameters.AddWithValue("@SearchTerm", DBNull.Value);
                        }
                        else
                        {
                            cmd.Parameters.Add("@SearchTerm", SqlDbType.NVarChar, -1).Value = deliveryChallanAdvanceSearch.SearchTerm;
                        }
                        cmd.Parameters.Add("@RowStart", SqlDbType.Int).Value = deliveryChallanAdvanceSearch.DataTablePaging.Start;
                        if (deliveryChallanAdvanceSearch.DataTablePaging.Length == -1)
                        {
                            cmd.Parameters.AddWithValue("@Length", DBNull.Value);
                        }
                        else
                        {
                            cmd.Parameters.Add("@Length", SqlDbType.Int).Value = deliveryChallanAdvanceSearch.DataTablePaging.Length;
                        }
                        cmd.Parameters.Add("@FromDate", SqlDbType.DateTime).Value = deliveryChallanAdvanceSearch.AdvFromDate;
                        cmd.Parameters.Add("@Todate", SqlDbType.DateTime).Value   = deliveryChallanAdvanceSearch.AdvToDate;
                        cmd.Parameters.Add("@AreaCode", SqlDbType.Int).Value      = deliveryChallanAdvanceSearch.AdvAreaCode;
                        cmd.Parameters.Add("@BranchCode", SqlDbType.Int).Value    = deliveryChallanAdvanceSearch.AdvBranchCode;
                        if (deliveryChallanAdvanceSearch.AdvCustomerID == Guid.Empty)
                        {
                            cmd.Parameters.AddWithValue("@CustomerID", DBNull.Value);
                        }
                        else
                        {
                            cmd.Parameters.Add("@CustomerID", SqlDbType.UniqueIdentifier).Value = deliveryChallanAdvanceSearch.AdvCustomerID;
                        }
                        if (deliveryChallanAdvanceSearch.AdvDocumentOwnerID == Guid.Empty)
                        {
                            cmd.Parameters.AddWithValue("@DocumentOwnerID", DBNull.Value);
                        }
                        else
                        {
                            cmd.Parameters.Add("@DocumentOwnerID", SqlDbType.UniqueIdentifier).Value = deliveryChallanAdvanceSearch.AdvDocumentOwnerID;
                        }
                        cmd.Parameters.Add("@ApprovalStatusCode", SqlDbType.Int).Value = deliveryChallanAdvanceSearch.AdvApprovalStatusCode;
                        cmd.Parameters.Add("@EmailSentYN", SqlDbType.NVarChar).Value   = deliveryChallanAdvanceSearch.AdvEmailSentStatus;
                        cmd.Parameters.Add("@PlantCode", SqlDbType.Int).Value          = deliveryChallanAdvanceSearch.AdvPlantCode;
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                deliveryChallanList = new List <DeliveryChallan>();
                                while (sdr.Read())
                                {
                                    DeliveryChallan deliveryChallan = new DeliveryChallan();
                                    {
                                        deliveryChallan.ID                          = (sdr["ID"].ToString() != "" ? Guid.Parse(sdr["ID"].ToString()) : deliveryChallan.ID);
                                        deliveryChallan.DelvChallanNo               = (sdr["DelvChallanNo"].ToString() != "" ? sdr["DelvChallanNo"].ToString() : deliveryChallan.DelvChallanNo);
                                        deliveryChallan.DelvChallanRefNo            = (sdr["DelvChallanRefNo"].ToString() != "" ? sdr["DelvChallanRefNo"].ToString() : deliveryChallan.DelvChallanRefNo);
                                        deliveryChallan.DelvChallanDate             = (sdr["DelvChallanDate"].ToString() != "" ? DateTime.Parse(sdr["DelvChallanDate"].ToString()) : deliveryChallan.DelvChallanDate);
                                        deliveryChallan.DelvChallanDateFormatted    = (sdr["DelvChallanDate"].ToString() != "" ? DateTime.Parse(sdr["DelvChallanDate"].ToString()).ToString(_settings.DateFormat) : deliveryChallan.DelvChallanDateFormatted);
                                        deliveryChallan.SaleOrder                   = new SaleOrder();
                                        deliveryChallan.SaleOrderID                 = (sdr["SaleOrderID"].ToString() != "" ? Guid.Parse(sdr["SaleOrderID"].ToString()) : deliveryChallan.SaleOrderID);
                                        deliveryChallan.SaleOrder.SaleOrderNo       = (sdr["SaleOrderNo"].ToString() != "" ? sdr["SaleOrderNo"].ToString() : deliveryChallan.SaleOrder.SaleOrderNo);
                                        deliveryChallan.ProductionOrder             = new ProductionOrder();
                                        deliveryChallan.ProdOrderID                 = (sdr["ProdOrderID"].ToString() != "" ? Guid.Parse(sdr["ProdOrderID"].ToString()) : deliveryChallan.ProdOrderID);
                                        deliveryChallan.ProductionOrder.ProdOrderNo = (sdr["ProdOrderNo"].ToString() != "" ? sdr["ProdOrderNo"].ToString() : deliveryChallan.ProductionOrder.ProdOrderNo);
                                        deliveryChallan.Customer                    = new Customer();
                                        deliveryChallan.Customer.CompanyName        = (sdr["CompanyName"].ToString() != "" ? sdr["CompanyName"].ToString() : deliveryChallan.Customer.CompanyName);
                                        deliveryChallan.Customer.ContactPerson      = (sdr["ContactPerson"].ToString() != "" ? sdr["ContactPerson"].ToString() : deliveryChallan.Customer.ContactPerson);

                                        deliveryChallan.Plant                      = new Plant();
                                        deliveryChallan.Plant.Description          = (sdr["Plant"].ToString() != "" ? sdr["Plant"].ToString() : deliveryChallan.Plant.Description);
                                        deliveryChallan.Employee                   = new Employee();
                                        deliveryChallan.Employee.Name              = (sdr["PreparedBy"].ToString() != "" ? sdr["PreparedBy"].ToString() : deliveryChallan.Employee.Name);
                                        deliveryChallan.Branch                     = new Branch();
                                        deliveryChallan.Branch.Description         = (sdr["Branch"].ToString() != "" ? sdr["Branch"].ToString() : deliveryChallan.Branch.Description);
                                        deliveryChallan.FilteredCount              = (sdr["FilteredCount"].ToString() != "" ? int.Parse(sdr["FilteredCount"].ToString()) : deliveryChallan.FilteredCount);
                                        deliveryChallan.TotalCount                 = (sdr["TotalCount"].ToString() != "" ? int.Parse(sdr["TotalCount"].ToString()) : deliveryChallan.FilteredCount);
                                        deliveryChallan.ApprovalStatus             = new ApprovalStatus();
                                        deliveryChallan.ApprovalStatus.Description = (sdr["ApprovalStatus"].ToString() != "" ? sdr["ApprovalStatus"].ToString() : deliveryChallan.ApprovalStatus.Description);
                                        deliveryChallan.PSAUser                    = new PSAUser();
                                        deliveryChallan.PSAUser.LoginName          = (sdr["DocumentOwner"].ToString() != "" ? (sdr["DocumentOwner"].ToString()) : deliveryChallan.PSAUser.LoginName);
                                        deliveryChallan.EmailSentYN                = (sdr["EmailSentYN"].ToString() != "" ? bool.Parse(sdr["EmailSentYN"].ToString()) : deliveryChallan.EmailSentYN);
                                        deliveryChallan.Area             = new Area();
                                        deliveryChallan.Area.Description = (sdr["Area"].ToString() != "" ? sdr["Area"].ToString() : deliveryChallan.Area.Description);
                                    }
                                    deliveryChallanList.Add(deliveryChallan);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(deliveryChallanList);
        }
Пример #13
0
        public DeliveryChallan GetDeliveryChallan(Guid id)
        {
            DeliveryChallan deliveryChallan = new DeliveryChallan();

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[PSA].[GetDeliveryChallan]";
                        cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = id;
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                if (sdr.Read())
                                {
                                    deliveryChallan.ID                              = (sdr["ID"].ToString() != "" ? Guid.Parse(sdr["ID"].ToString()) : deliveryChallan.ID);
                                    deliveryChallan.DelvChallanNo                   = (sdr["DelvChallanNo"].ToString() != "" ? sdr["DelvChallanNo"].ToString() : deliveryChallan.DelvChallanNo);
                                    deliveryChallan.DelvChallanRefNo                = (sdr["DelvChallanRefNo"].ToString() != "" ? sdr["DelvChallanRefNo"].ToString() : deliveryChallan.DelvChallanRefNo);
                                    deliveryChallan.DelvChallanDate                 = (sdr["DelvChallanDate"].ToString() != "" ? DateTime.Parse(sdr["DelvChallanDate"].ToString()) : deliveryChallan.DelvChallanDate);
                                    deliveryChallan.DelvChallanDateFormatted        = (sdr["DelvChallanDate"].ToString() != "" ? DateTime.Parse(sdr["DelvChallanDate"].ToString()).ToString(_settings.DateFormat) : deliveryChallan.DelvChallanDateFormatted);
                                    deliveryChallan.SaleOrderID                     = (sdr["SaleOrderID"].ToString() != "" ? Guid.Parse(sdr["SaleOrderID"].ToString()) : deliveryChallan.SaleOrderID);
                                    deliveryChallan.ProdOrderID                     = (sdr["ProdOrderID"].ToString() != "" ? Guid.Parse(sdr["ProdOrderID"].ToString()) : deliveryChallan.ProdOrderID);
                                    deliveryChallan.CustomerID                      = (sdr["CustomerID"].ToString() != "" ? Guid.Parse(sdr["CustomerID"].ToString()) : deliveryChallan.CustomerID);
                                    deliveryChallan.PlantCode                       = (sdr["PlantCode"].ToString() != "" ? int.Parse(sdr["PlantCode"].ToString()) : deliveryChallan.PlantCode);
                                    deliveryChallan.PreparedBy                      = (sdr["PreparedBy"].ToString() != "" ? Guid.Parse(sdr["PreparedBy"].ToString()) : deliveryChallan.PreparedBy);
                                    deliveryChallan.GeneralNotes                    = (sdr["GeneralNotes"].ToString() != "" ? (sdr["GeneralNotes"]).ToString() : deliveryChallan.GeneralNotes);
                                    deliveryChallan.DocumentOwnerID                 = (sdr["DocumentOwnerID"].ToString() != "" ? Guid.Parse(sdr["DocumentOwnerID"].ToString()) : deliveryChallan.DocumentOwnerID);
                                    deliveryChallan.Branch                          = new Branch();
                                    deliveryChallan.Branch.Description              = (sdr["Branch"].ToString() != "" ? sdr["Branch"].ToString() : deliveryChallan.Branch.Description);
                                    deliveryChallan.Branch.Code                     = (sdr["BranchCode"].ToString() != "" ? int.Parse(sdr["BranchCode"].ToString()) : deliveryChallan.Branch.Code);
                                    deliveryChallan.BranchCode                      = (sdr["BranchCode"].ToString() != "" ? int.Parse(sdr["BranchCode"].ToString()) : deliveryChallan.BranchCode);
                                    deliveryChallan.VehiclePlateNo                  = (sdr["VehiclePlateNo"].ToString() != "" ? sdr["VehiclePlateNo"].ToString() : deliveryChallan.VehiclePlateNo);
                                    deliveryChallan.DriverName                      = (sdr["DriverName"].ToString() != "" ? sdr["DriverName"].ToString() : deliveryChallan.DriverName);
                                    deliveryChallan.DocumentOwners                  = (sdr["DocumentOwners"].ToString() != "" ? sdr["DocumentOwners"].ToString().Split(',') : deliveryChallan.DocumentOwners);
                                    deliveryChallan.DocumentOwner                   = (sdr["DocumentOwner"].ToString() != "" ? sdr["DocumentOwner"].ToString() : deliveryChallan.DocumentOwner);
                                    deliveryChallan.LatestApprovalIDv               = (sdr["LatestApprovalIDv"].ToString() != "" ? Guid.Parse(sdr["LatestApprovalIDv"].ToString()) : deliveryChallan.LatestApprovalIDv);
                                    deliveryChallan.LatestApprovalStatus            = (sdr["LatestApprovalStatus"].ToString() != "" ? int.Parse(sdr["LatestApprovalStatus"].ToString()) : deliveryChallan.LatestApprovalStatus);
                                    deliveryChallan.LatestApprovalStatusDescription = (sdr["ApprovalDescription"].ToString() != "" ? (sdr["ApprovalDescription"].ToString()) : deliveryChallan.LatestApprovalStatusDescription);
                                    deliveryChallan.Customer                        = new Customer();
                                    deliveryChallan.Customer.CompanyName            = (sdr["CompanyName"].ToString() != "" ? sdr["CompanyName"].ToString() : deliveryChallan.Customer.CompanyName);
                                    deliveryChallan.Customer.ID                     = (sdr["CustomerID"].ToString() != "" ? Guid.Parse(sdr["CustomerID"].ToString()) : deliveryChallan.Customer.ID);
                                    deliveryChallan.SaleOrder                       = new SaleOrder();
                                    deliveryChallan.SaleOrder.SaleOrderNo           = (sdr["SaleOrderNo"].ToString() != "" ? sdr["SaleOrderNo"].ToString() : deliveryChallan.SaleOrder.SaleOrderNo);
                                }
                            }
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }

            return(deliveryChallan);
        }
Пример #14
0
        private void guna2Button1_Click(object sender, EventArgs e)
        {
            DeliveryChallan si = new DeliveryChallan();

            si.Show();
        }
Пример #15
0
 public void Create(DeliveryChallan DeliveryChallan)
 {
     _DeliveryChallanRepository.Add(DeliveryChallan);
     _UnitOfWork.Commit();
 }
Пример #16
0
 public IActionResult AddDeliveryChallan([FromBody] DeliveryChallan model)
 {
     model.ChallanNumber = GenCN();
     challan_repo.Add(model);
     return(new OkObjectResult(new { DeliveryChallanId = model.DeliveryChallanId }));
 }
Пример #17
0
 public void Update(DeliveryChallan DeliveryChallan)
 {
     _DeliveryChallanRepository.Update(DeliveryChallan);
     _UnitOfWork.Commit();
 }