コード例 #1
0
        public void r105Implementation(OrdersWaitingForPriceChangeModel instance)
        {
            // This is the placeholder for method implementation.


            int ordStatus = 5;     // sent for approval lv1

            if (UserIsInRole("SalesClerk"))
            {
                SqlText.ExecuteNonQuery("Update OrderHed Set OrderStatusID=@OrderStatusID Where OrderHedID=@OrderHedID ",
                                        new { @OrderHedID = instance.OrderHedID, @OrderStatusID = ordStatus });

                SqlText.ExecuteNonQuery(
                    "Insert into OrderStatusLog (OrderHedID,UserID,[Comment],[RejectReason],[OtherRemarks],[TranDate]) Values " +
                    "(@OrderHedID,@UserID,@Comment,@RejectReason,@OtherRemarks,@TranDate) "
                    , new
                {
                    @OrderHedID   = instance.OrderHedID,
                    @UserID       = UserId,
                    @Comment      = "Price Change Request Accepted.",
                    @RejectReason = "",
                    @OtherRemarks = "",
                    @TranDate     = DateTime.Now
                });

                //Result.ShowAlert("OrderNo : {0} Price Change Request Accepted.",instance.OrderHedID);
            }
        }
        public void r101Implementation(OrdersWaitingForPriceChangeModel instance)
        {
            // This is the placeholder for method implementation.
            if (Arguments.CommandArgument == "OrderDtlVw2")
            {
                //decimal total = (decimal)SqlText.ExecuteScalar("select isnull(Sum(SellingPrice * OrderQty),0) From OrderDtl Where OrderHedID=@OrderHedID ",
                //                    instance.OrderHedID);
                //instance.TotalAmount = total;

                //int i = SqlText.ExecuteNonQuery("Update OrderHed Set TotalAmount=@total Where OrderHedID=@OrderHedID",
                //    total, instance.OrderHedID);

                decimal total = (decimal)SqlText.ExecuteScalar("select isnull(Sum(SellingPrice * OrderQty),0) From OrderDtl Where OrderHedID=@OrderHedID ",
                                                               instance.OrderHedID);

                decimal proposedTotal = (decimal)SqlText.ExecuteScalar("select isnull(Sum(IIF(ProposedSellingPrice is null, SellingPrice,ProposedSellingPrice) * OrderQty),0) From OrderDtl Where OrderHedID=@OrderHedID ",
                                                                       instance.OrderHedID);

                instance.TotalAmount = proposedTotal > 0 ? proposedTotal : total;

                string totalAmount = instance.TotalAmount.ToString();

                int i = SqlText.ExecuteNonQuery("Update OrderHed Set TotalAmount=@totalAmount Where OrderHedID=@OrderHedID",
                                                instance.TotalAmount, instance.OrderHedID);
            }
        }
コード例 #3
0
        public void r102Implementation(OrdersWaitingForPriceChangeModel instance)
        {
            // This is the placeholder for method implementation.
            Finsoft.Data.PageRequest page = (Finsoft.Data.PageRequest)Context.Items["PageRequest_Current"];
            if (page.View == "editForm1")
            {
                if (instance.OrderHedID != null)
                {
                    var custInfo = SqlText.Execute("select * from vwCustomer a inner join OrderHed b On a.SysRowID=b.CustSysRowID where b.OrderHedID=@OrderHedID", new { OrderHedID = instance.OrderHedID });

                    if (custInfo != null)
                    {
                        instance.CAddress1         = custInfo[5].ToString();
                        instance.CAddress2         = custInfo[6].ToString();
                        instance.CAddress3         = custInfo[7].ToString();
                        instance.CCity             = custInfo[8].ToString();
                        instance.CState            = custInfo[9].ToString();
                        instance.CZip              = custInfo[10].ToString();
                        instance.CCountry          = custInfo[11].ToString();
                        instance.CreditLimit       = Convert.ToDecimal(custInfo[14]);
                        instance.Balance           = Convert.ToDecimal(custInfo[13]);
                        instance.UnPaidInvoices    = Convert.ToDecimal(custInfo[15]);
                        instance.OutStandingOrders = Convert.ToDecimal(custInfo[16]);
                        instance.UnPostedInvoices  = Convert.ToDecimal(custInfo[17]);
                        instance.AgeCurr           = Convert.ToDecimal(custInfo[18]);
                        instance.Age30             = Convert.ToDecimal(custInfo[19]);
                        instance.Age60             = Convert.ToDecimal(custInfo[20]);
                        instance.Age90             = Convert.ToDecimal(custInfo[21]);
                        instance.Age120            = Convert.ToDecimal(custInfo[22]);
                        instance.Age150            = Convert.ToDecimal(custInfo[23]);
                        instance.TermsExceed       = Convert.ToBoolean(custInfo[24]);
                        instance.PhoneNum          = custInfo[26].ToString();
                        instance.FaxNum            = custInfo[27].ToString();
                    }
                }

                if (instance.OrderHedID != null)
                {
                    var shipInfo = SqlText.Execute("select * from vwShipTo a inner join OrderHed b On a.SysRowID=b.ShipToSysRowID where b.OrderHedID=@OrderHedID", new { OrderHedID = instance.OrderHedID });
                    if (shipInfo != null)
                    {
                        instance.SAddress1 = shipInfo[6].ToString();
                        instance.SAddress2 = shipInfo[7].ToString();
                        instance.SAddress3 = shipInfo[8].ToString();
                        instance.SCity     = shipInfo[9].ToString();
                        instance.SState    = shipInfo[10].ToString();
                        instance.SZip      = shipInfo[11].ToString();
                        instance.SCountry  = shipInfo[12].ToString();
                        instance.SPhoneNum = shipInfo[14].ToString();
                        instance.SFaxNum   = shipInfo[15].ToString();
                    }
                }
            }
        }
 public void r109Implementation(OrdersWaitingForPriceChangeModel instance)
 {
     // This is the placeholder for method implementation.
     if (instance.OrderHedID == null)
     {
         Result.ShowAlert("Please Select Order!");
     }
     else if (string.IsNullOrEmpty(instance.CompanyName))
     {
         Result.ShowAlert("Company is Empty!");
     }
     else if (string.IsNullOrEmpty(instance.CustID))
     {
         Result.ShowAlert("Customer is Empty!");
     }
     else
     {
         string custid = string.Format("{0},{1}", instance.CustID, instance.CustID);
         Result.NavigateUrl = string.Format("~/CustomReport.ashx?Company={0}&CustId={1}&FileName={2}", instance.CompanyName, custid, instance.CustID);
     }
 }
 public void r100Implementation(OrdersWaitingForPriceChangeModel instance)
 {
     // This is the placeholder for method implementation.
 }