コード例 #1
0
        /// <summary>
        /// GetDefault R_Status_ID
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="fields"></param>
        /// <returns></returns>
        public int GetDefaultR_Status_ID(Ctx ctx, string fields)
        {
            string[] paramValue = fields.Split(',');
            int      R_RequestType_ID;

            //Assign parameter value
            R_RequestType_ID = Util.GetValueOfInt(paramValue[0].ToString());
            //End Assign parameter value

            MRequestType rt          = MRequestType.Get(ctx, R_RequestType_ID);
            int          R_Status_ID = rt.GetDefaultR_Status_ID();

            return(R_Status_ID);
        }
コード例 #2
0
        public JsonResult GetDefaultR_Status_ID(string fields)
        {
            string retJSON = "";

            if (Session["ctx"] != null)
            {
                VAdvantage.Utility.Ctx ctx = Session["ctx"] as Ctx;
                string[] paramValue        = fields.Split(',');
                int      R_RequestType_ID;

                //Assign parameter value
                R_RequestType_ID = Util.GetValueOfInt(paramValue[0].ToString());
                MRequestType rt          = MRequestType.Get(ctx, R_RequestType_ID);
                int          R_Status_ID = rt.GetDefaultR_Status_ID();


                //List<Decimal> retlst = new List<Decimal>();
                //retlst.Add(currentBalance);

                retJSON = JsonConvert.SerializeObject(R_Status_ID);
            }
            return(Json(retJSON, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        protected override string DoIt()
        {
            _req = new MRequest(GetCtx(), GetRecord_ID(), null);

            // check mail template if found on request or request type.
            mailText_ID = _req.GetR_MailText_ID();
            if (mailText_ID == 0)
            {
                MRequestType reqType = new MRequestType(GetCtx(), _req.GetR_RequestType_ID(), null);
                if (reqType.GetR_MailText_ID() > 0)
                {
                    mailText_ID = reqType.GetR_MailText_ID();
                }
            }
            if (mailText_ID == 0)
            {
                GetReqHistory();
                if (_reqAction == null)
                {
                    return(Msg.GetMsg(GetCtx(), "R_NoReqChanges"));
                }
                string changedValues = _reqAction.GetChangedValues();
                bool   _changed      = false;
                sendInfo = new List <String>();

                if (!string.IsNullOrEmpty(changedValues))
                {
                    string[] strValues = changedValues.Split(',');
                    if (strValues.Length > 0)
                    {
                        for (int i = 0; i < strValues.Length; i++)
                        {
                            _changed = true;
                            sendInfo.Add(strValues[i]);
                        }
                    }
                }

                #region commented
                //
                //if (_req.GetR_RequestType_ID() != _reqAction.GetR_RequestType_ID() && _reqAction.GetR_RequestType_ID() > 0)
                //{
                //    _changed = true;
                //    sendInfo.Add("R_RequestType_ID");
                //}
                //if (_req.GetR_Group_ID() != _reqAction.GetR_Group_ID() && _reqAction.GetR_Group_ID() > 0)
                //{
                //    _changed = true;
                //    sendInfo.Add("R_Group_ID");
                //}
                //if (_req.GetR_Category_ID() != _reqAction.GetR_Category_ID() && _reqAction.GetR_Category_ID() > 0)
                //{
                //    _changed = true;
                //    sendInfo.Add("R_Category_ID");
                //}
                //if (_req.GetR_Status_ID() != _reqAction.GetR_Status_ID() && _reqAction.GetR_Status_ID() > 0)
                //{
                //    _changed = true;
                //    sendInfo.Add("R_Status_ID");
                //}
                //if (_req.GetR_Resolution_ID() != _reqAction.GetR_Resolution_ID() && _reqAction.GetR_Resolution_ID() > 0)
                //{
                //    _changed = true;
                //    sendInfo.Add("R_Resolution_ID");
                //}
                ////
                //if (_req.GetSalesRep_ID() != _reqAction.GetSalesRep_ID() && _reqAction.GetSalesRep_ID() > 0)
                //{
                //    _changed = true;
                //    sendInfo.Add("SalesRep_ID");
                //}
                ////
                //if (_req.GetPriority() != _reqAction.GetPriority() && !string.IsNullOrEmpty(_reqAction.GetPriority()))
                //{
                //    _changed = true;
                //    sendInfo.Add("Priority");
                //}
                //if (_req.GetPriorityUser() != _reqAction.GetPriorityUser() && !string.IsNullOrEmpty(_reqAction.GetPriorityUser()))
                //{
                //    _changed = true;
                //    sendInfo.Add("PriorityUser");
                //}
                //if (_req.GetSummary() != _reqAction.GetSummary() && !string.IsNullOrEmpty(_reqAction.GetSummary()))
                //{
                //    _changed = true;
                //    sendInfo.Add("Summary");
                //}
                #endregion
                if (sendInfo.Count > 0 && _changed)
                {
                    prepareNotificMsg(sendInfo);
                    // For Role Changes
                    Thread thread = new Thread(new ThreadStart(() => SendNotices(sendInfo)));
                    thread.Start();
                    return(Msg.GetMsg(GetCtx(), "R_EmailBackgrndRun"));
                }
                else
                {
                    return(Msg.GetMsg(GetCtx(), "R_NoReqChanges"));
                }
            }
            else
            {
                prepareNotificMsg(sendInfo);
                // For Role Changes
                Thread thread = new Thread(new ThreadStart(() => SendNotices(sendInfo)));
                thread.Start();
                return(Msg.GetMsg(GetCtx(), "R_EmailBackgrndRun"));
            }

            return("");
        }
コード例 #4
0
        } //	prepare

        /// <summary>
        ///	Process
        /// </summary>
        /// <returns>info</returns>
        protected override String DoIt()
        {
            int lenth = 1;

            log.Info("R_RequestType_ID=" + _R_RequestType_ID + ", R_Group_ID=" + _R_Group_ID
                     + ", R_Category_ID=" + _R_Category_ID + ", C_BPartner_ID=" + _C_BPartner_ID
                     + ", _M_Product_ID=" + _M_Product_ID);

            MRequestType type = MRequestType.Get(GetCtx(), _R_RequestType_ID);

            if (type.Get_ID() == 0)
            {
                throw new Exception("@R_RequestType_ID@ @NotFound@ " + _R_RequestType_ID);
            }

            if (!type.IsInvoiced())
            {
                throw new Exception("@R_RequestType_ID@ <> @IsInvoiced@");
            }

            String sql = "SELECT * FROM R_Request r"
                         + " INNER JOIN R_Status s ON (r.R_Status_ID=s.R_Status_ID) "
                         + "WHERE s.IsClosed='Y'"
                         + " AND r.R_RequestType_ID=@Param1";

            if (_R_Group_ID != 0 && _R_Group_ID != -1)
            {
                sql  += " AND r.R_Group_ID=@Param2";
                lenth = lenth + 1;
            }
            if (_R_Category_ID != 0 && _R_Category_ID != -1)
            {
                sql  += " AND r.R_Category_ID=@Param3";
                lenth = lenth + 1;
            }
            if (_C_BPartner_ID != 0)
            {
                sql  += " AND r.C_BPartner_ID=@Param4";
                lenth = lenth + 1;
            }
            sql += " AND r.IsInvoiced='Y' "
                   + "ORDER BY C_BPartner_ID";
            SqlParameter[] Param = new SqlParameter[lenth];
            IDataReader    idr   = null;
            DataTable      dt    = null;

            try
            {
                int index = 0;
                Param[index] = new SqlParameter("@Param1", _R_RequestType_ID);
                if (_R_Group_ID != 0 && _R_Group_ID != -1)
                {
                    index++;
                    Param[index] = new SqlParameter("@Param2", _R_Group_ID);
                }
                if (_R_Category_ID != 0 && _R_Category_ID != -1)
                {
                    index++;
                    Param[index] = new SqlParameter("@Param3", _R_Category_ID);
                }
                if (_C_BPartner_ID != 0)
                {
                    index++;
                    Param[index] = new SqlParameter("@Param4", _C_BPartner_ID);
                }
                idr = DataBase.DB.ExecuteReader(sql, Param, Get_TrxName());
                dt  = new DataTable();
                dt.Load(idr);
                idr.Close();
                int oldC_BPartner_ID = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    MRequest request = new MRequest(GetCtx(), dr, Get_TrxName());
                    if (!request.IsInvoiced())
                    {
                        continue;
                    }
                    if (oldC_BPartner_ID != request.GetC_BPartner_ID())
                    {
                        InvoiceDone();
                    }
                    if (_m_invoice == null)
                    {
                        InvoiceNew(request);
                        oldC_BPartner_ID = request.GetC_BPartner_ID();
                    }
                    InvoiceLine(request);
                }
                InvoiceDone();
                //
            }
            catch (Exception e)
            {
                if (idr != null)
                {
                    idr.Close();
                }
                log.Log(Level.SEVERE, sql, e);
            }
            finally
            {
                dt = null;
                if (idr != null)
                {
                    idr.Close();
                }
            }
            if (string.IsNullOrEmpty(_msg))
            {
                _msg = "No Invoice Generated";
            }
            //	R_Category_ID
            return(_msg);
        } //	doIt