예제 #1
0
 public JsonResult AdhocActionOnDisbursementItems(string DisbursementIds, int Adhoc, string ForState)
 {
     System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
     System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
     log.Debug("Start: " + methodBase.Name);
     try
     {
         int checkSession = UserLogin.AuthenticateRequest();
         if (checkSession == 0)
         {
             return Json(checkSession);
         }
         else
         {
             DisbursementItem objDisbursementItem = new DisbursementItem();
             int result = objDisbursementItem.AdhocActionOnDisbursementItems(DisbursementIds, Adhoc, ForState, checkSession);
             return Json(result);
         }
     }
     catch (Exception ex)
     {
         log.Error("Error: " + ex);
         return Json("");
     }
     finally
     {
         log.Debug("End: " + methodBase.Name);
     }
 }
예제 #2
0
 //Need to check
 private DisbursementItem FetchDisbursementItemsByID(DisbursementItem SearchDisbursementItem, SafeDataReader dr)
 {
     SearchDisbursementItem.WorkOrderNumber = dr.GetString("WOCode").Trim();
     SearchDisbursementItem.ClientNumber = dr.GetString("ClientName");
     SearchDisbursementItem.ID = dr.GetInt32("ID");
     SearchDisbursementItem.RefID = SearchDisbursementItem.ID;
     SearchDisbursementItem.WOID = dr.GetInt32("WOID");
     SearchDisbursementItem.Type = dr.GetString("DIType");
     SearchDisbursementItem.Units = dr.GetInt32("Units");
     SearchDisbursementItem.Code = dr.GetString("ItemCode");
     SearchDisbursementItem.ItemNumber = dr.GetString("ItemNumber");
     SearchDisbursementItem.Amount = dr.GetDecimal("Amount");
     SearchDisbursementItem.Description = dr.GetString("Description");
     SearchDisbursementItem.DateIncurred = dr.GetString("DateIncurred");
     SearchDisbursementItem.VenderRefID = dr.GetString("VenderRefId");
     SearchDisbursementItem.IsVerified = dr.GetBoolean("IsVerified");
     SearchDisbursementItem.IsAdhoc = dr.GetBoolean("IsAdhoc");
     SearchDisbursementItem.IsArchived = dr.GetBoolean("IsArchived");
     SearchDisbursementItem.IsBilled = dr.GetBoolean("IsBilled");
     SearchDisbursementItem.UnitPrice = dr.GetDecimal("UnitPrice");
     SearchDisbursementItem.NeedVerification = dr.GetBoolean("NeedVerification");
     SearchDisbursementItem.NoteCount = dr.GetInt32("NoteCount");
     SearchDisbursementItem.NoteType = dr.GetString("NoteType");
     SearchDisbursementItem.CreatedDate = dr.GetDateTime("CreatedDate").ToString("dd MMM yyyy hh:mm:ss tt");
     SearchDisbursementItem.ACCPACStatus = dr.GetInt32("ACCPACStatus");
     SearchDisbursementItem.ACCPACDescription = dr.GetString("ACCPACDescription");
     SearchDisbursementItem.ACCPACExplanation = dr.GetString("Explaination");
     SearchDisbursementItem.InvoiceNumber = dr.GetString("InvoiceNumber");
     SearchDisbursementItem.IsMatched = dr.GetBoolean("IsMatched");
     return SearchDisbursementItem;
 }
예제 #3
0
 public JsonResult InsertWorkOrder(string Type, string Desc, bool Billable, int ClientOrCustomerID, string SourceID, string GroupCode, bool IsAdhoc, string StatusCode, bool IsPostedToCss1)
 {
     System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
     System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
     log.Debug("Start: " + methodBase.Name);
     try
     {
         int checkSession = UserLogin.AuthenticateRequest();
         if (checkSession == 0)
         {
             return Json(checkSession);
         }
         else
         {
             int createdBy = Convert.ToInt32(Session["UserID"]);
             var data = new DisbursementItem
             {
                 Type = Type,
                 Description = HttpUtility.UrlDecode(Desc),
                 CreatedBy = createdBy,
                 Billable = Billable,
                 ClientOrCustomerID = ClientOrCustomerID,
                 SourceID = SourceID,
                 GroupCode = GroupCode,
                 IsAdhoc = IsAdhoc,
                 StatusCode = StatusCode,
                 IsPostedToCss1 = IsPostedToCss1,
             };
             var output = data.InsertWorkOrder();
             return Json(output);
         }
     }
     catch (Exception ex)
     {
         log.Error("Error: " + ex);
         return Json("");
     }
     finally
     {
         log.Debug("End: " + methodBase.Name);
     }
 }
예제 #4
0
 private DisbursementItem FetchCurrencyType(DisbursementItem CurrencyType, SafeDataReader dr)
 {
     CurrencyType.ID = dr.GetInt32("ID");
     CurrencyType.Code = dr.GetString("Code");
     return CurrencyType;
 }
예제 #5
0
 private DisbursementItem FetchDisbursementItems(DisbursementItem disbursementItems, SafeDataReader dr)
 {
     disbursementItems.ID = dr.GetInt32("ID");
     disbursementItems.WOID = dr.GetInt32("WOID");
     disbursementItems.Amount = dr.GetDecimal("Amount");
     disbursementItems.ItemCode = dr.GetString("ItemCode");
     disbursementItems.Description = dr.GetString("Description");
     disbursementItems.VenderRefID = dr.GetString("VenderRefId");
     disbursementItems.Units = dr.GetInt32("Units");
     disbursementItems.Code = dr.GetString("Code");
     disbursementItems.Type = dr.GetString("DIType");
     disbursementItems.IsBilled = dr.GetBoolean("IsBilled");
     disbursementItems.IsAdhoc = dr.GetBoolean("IsAdhoc");
     disbursementItems.IsArchived = dr.GetBoolean("IsArchived");
     disbursementItems.IsVerified = dr.GetBoolean("IsVerified");
     return disbursementItems;
 }
예제 #6
0
        /// <summary>
        /// Description  : Get MWorkOrderType from database for Type dropdown in WorkOrder. 
        /// Created By   : Shiva
        /// Created Date : 20 May 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns></returns>
        public static WorkOrdersAndDItemsInfo GetWorkOrderType()
        {
            var data = new WorkOrdersAndDItemsInfo();

            var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SPGetMWorkOrderType");
            var safe = new SafeDataReader(reader);
            while (reader.Read())
            {
                var getIDFromDIType = new DisbursementItem();
                getIDFromDIType.FetchIDAndNameFromWOType(getIDFromDIType, safe);
                data.OrdersList.Add(getIDFromDIType);
            }
            return data;
        }
예제 #7
0
        /// <summary>
        /// Created By    : Pavan
        /// Created Date  : 19 May 2014
        /// Modified By   :  
        /// Modified Date :  
        /// <returns> Insert the Type, Description, Status to Work order  </returns>
        /// </summary>
        public WorkOrdersAndDItemsInfo InsertWorkOrder()
        {
            SqlParameter[] sqlParams = new SqlParameter[11];
            sqlParams[0] = new SqlParameter("@Type", this.Type);
            sqlParams[1] = new SqlParameter("@Billable", this.Billable);
            sqlParams[2] = new SqlParameter("@Description", this.Description);
            //sqlParams[4] = new SqlParameter("@Status", this.Status);
            sqlParams[3] = new SqlParameter("@CreatedBy", this.CreatedBy);
            //  sqlParams[5] = new SqlParameter("@ID", this.ID);
            sqlParams[4] = new SqlParameter("@GroupCode", this.GroupCode);
            sqlParams[5] = new SqlParameter("@IsAdhoc", this.IsAdhoc);
            sqlParams[6] = new SqlParameter("@ClientOrCustomerID", this.ClientOrCustomerID);
            sqlParams[7] = new SqlParameter("@SourceID", this.SourceID);
            sqlParams[8] = new SqlParameter("@StatusCode", this.StatusCode);
            sqlParams[9] = new SqlParameter("@IsPostedToCss1", this.IsPostedToCss1);
            if (this.IsPostedToCss1 == true)
                sqlParams[10] = new SqlParameter("@PostedTOCss1Date", DateTime.Now);
            else
                sqlParams[10] = new SqlParameter("@PostedTOCss1Date", DBNull.Value);

            //sqlParams[12] = new SqlParameter("@Output", 0);
            //sqlParams[12].Direction = ParameterDirection.Output;

            var data = new WorkOrdersAndDItemsInfo();
            var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SpInsertWorkOrder", sqlParams);
            var safe = new SafeDataReader(reader);
            while (reader.Read())
            {
                var getWO = new DisbursementItem();
                FetchInsertedWO(getWO, safe);
                data.OrdersList.Add(getWO);
            }
            return data;
            // int output = Convert.ToInt32(sqlParams[12].Value);
            // return output;
        }
예제 #8
0
        /// <summary>
        /// Created By    : Shiva
        /// Created Date  : 19 May 2014
        /// Modified By   :  
        /// Modified Date :  
        /// <returns> Get the current WorkOrderID Disbursement Items data </returns>
        /// </summary>
        public static WorkOrdersAndDItemsInfo GetDisbursementItemsData(int WOID, int startpage, int rowsperpage)
        {
            var disbursementItemsData = new WorkOrdersAndDItemsInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[3];
                sqlParams[0] = new SqlParameter("@WorkOrderID", WOID);
                sqlParams[1] = new SqlParameter("@startpage", startpage);
                sqlParams[2] = new SqlParameter("@rowsPerPage", rowsperpage);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[GetDisbursementItemsByWOID]", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var Item = new DisbursementItem();
                    Item.FetchDisbursementItemsForSearch(Item, safe);
                    disbursementItemsData.OrdersList.Add(Item);
                    disbursementItemsData.OrdersCount = Convert.ToInt32(reader["DICount"]);
                }
                reader.NextResult();
                while (reader.Read())
                {
                    var Instate = new DIInstate();
                    Instate.FetchDIInstate(Instate, safe);
                    disbursementItemsData.DiInstate.Add(Instate);
                }

                reader.NextResult();
                while (reader.Read())
                {
                    var Rules = new DIActionRules();
                    Rules.FetchDIActionRules(Rules, safe);
                    disbursementItemsData.DiActionRules.Add(Rules);
                }
                return disbursementItemsData;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return disbursementItemsData;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
예제 #9
0
        /// <summary>
        /// Description  : To get the MDIType Details By ItemNumber for the partial view.
        /// Created By   : Shiva
        /// Created Date : 4 June 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns></returns>
        /// 
        public static WorkOrdersAndDItemsInfo GetMDITypeDetailsByItemNumber(int DIID)
        {
            var MCurrencyTypeData = new WorkOrdersAndDItemsInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[1];
                sqlParams[0] = new SqlParameter("@ID", DIID);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SpGetMDITypeDetailsByID", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var Item = new DisbursementItem();
                    Item.FetchDITypeDetailsByItemNumber(Item, safe);
                    MCurrencyTypeData.OrdersList.Add(Item);
                }
                return MCurrencyTypeData;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return MCurrencyTypeData;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
예제 #10
0
        /// <summary>
        /// Description  : Get DisburesementItems as per search Results. 
        /// Created By   : pavan
        /// Created Date : 19 May 2014
        /// Modified By  : Shiva
        /// Modified Date: 11 Aug 2014
        /// </summary>
        /// <returns></returns>
        public static WorkOrdersAndDItemsInfo GetAllSearchDisbursementItems(string clientID, string SourceID, string WO, string venderRefId, string Type, string IsVerified, string IsBilled, string IsArchived, string IsAdhoc, string OrderBy, int startpage, int rowsperpage, string FromDate, string ToDate,int ACCPACStatus)
        {
            var data = new WorkOrdersAndDItemsInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[15];
                //sqlParams[0] = new SqlParameter("@ItemNumber", clientName);
                sqlParams[0] = new SqlParameter("@WO", WO);
                sqlParams[1] = new SqlParameter("@VenderRefId", venderRefId);
                sqlParams[2] = new SqlParameter("@Type", Type);
                sqlParams[3] = new SqlParameter("@IsVerified", IsVerified);
                sqlParams[4] = new SqlParameter("@IsBilled", IsBilled);
                sqlParams[5] = new SqlParameter("@IsArchived", IsArchived);
                sqlParams[6] = new SqlParameter("@IsAdhoc", IsAdhoc);
                sqlParams[7] = new SqlParameter("@OrderBy", OrderBy);
                sqlParams[8] = new SqlParameter("@startPage", startpage);
                sqlParams[9] = new SqlParameter("@resultPerPage", rowsperpage);
                sqlParams[10] = new SqlParameter("@ClientID", clientID);
                sqlParams[11] = new SqlParameter("@SourceID", SourceID);
                sqlParams[12] = new SqlParameter("@FromDate", HelperClasses.ConvertDateFormat(FromDate));
                sqlParams[13] = new SqlParameter("@ToDate", HelperClasses.ConvertDateFormat(ToDate));
                sqlParams[14] = new SqlParameter("@ACCPACStatus", ACCPACStatus);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SpGetAllDisbursementItems", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var SearchDisbursementItem = new DisbursementItem();
                    SearchDisbursementItem.FetchDisbursementItemsForSearch(SearchDisbursementItem, safe);
                    data.OrdersList.Add(SearchDisbursementItem);
                    data.OrdersCount = Convert.ToInt32(reader["DICount"]);
                }
                reader.NextResult();
                while (reader.Read())
                {
                    var Instate = new DIInstate();
                    Instate.FetchDIInstate(Instate, safe);
                    data.DiInstate.Add(Instate);
                }

                reader.NextResult();
                while (reader.Read())
                {
                    var ActionRules = new DIActionRules();
                    ActionRules.FetchDIActionRules(ActionRules, safe);
                    data.DiActionRules.Add(ActionRules);
                }
                return data;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return data;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
예제 #11
0
        /// <summary>
        /// Description  : Get Disbursement details by ID  
        /// Created By   : Shiva
        /// Created Date : 6 June 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public static WorkOrdersAndDItemsInfo GetDisbursementItemsByID(int ID, string VenderRefID)
        {
            var data = new WorkOrdersAndDItemsInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[2];
                sqlParams[0] = new SqlParameter("@ID", ID);
                sqlParams[1] = new SqlParameter("@VenderRefID", VenderRefID);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SPGetDisbursementDataByID", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var SearchDisbursementItem = new DisbursementItem();
                    SearchDisbursementItem.FetchDisbursementItemsByID(SearchDisbursementItem, safe);
                    data.OrdersList.Add(SearchDisbursementItem);
                }
                safe.NextResult();
                while (reader.Read())
                {
                    data.VendorAmount = Convert.ToDecimal(reader["Amount"]);
                    data.VendorReport = Convert.ToString(reader["VRID"]);
                }
                safe.NextResult();
                while (reader.Read())
                {
                    data.OrdersCount = Convert.ToInt32(reader["RelatedDICount"]);
                }
                return data;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return data;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
예제 #12
0
 private DisbursementItem FetchInsertedWO(DisbursementItem InsertedWO, SafeDataReader dr)
 {
     InsertedWO.ID = dr.GetInt32("ID");
     InsertedWO.WOCode = dr.GetString("WOCode").Trim();
     InsertedWO.ClientName = dr.GetString("ClientName");
     return InsertedWO;
 }
예제 #13
0
 private DisbursementItem FetchIDAndNameFromWOType(DisbursementItem WOType, SafeDataReader dr)
 {
     WOType.ID = dr.GetInt32("ID");
     WOType.Name = dr.GetString("Name");
     return WOType;
 }
예제 #14
0
 private DisbursementItem FetchDITypeDetailsByItemNumber(DisbursementItem dIType, SafeDataReader dr)
 {
     dIType.Code = dr.GetString("Code");
     if (dr["UnitPrice"] != null)
     {
         dIType.UnitPrice = dr.GetDecimal("UnitPrice");
     }
     else
     {
         dIType.UnitPrice = null;
     }
     dIType.Description = dr.GetString("Description");
     dIType.NeedVerification = dr.GetBoolean("NeedVerification");
     dIType.Quantity = dr.GetInt32("Units");
     return dIType;
 }
예제 #15
0
 private DisbursementItem FetchDIType(DisbursementItem dIType, SafeDataReader dr)
 {
     dIType.ID = dr.GetInt32("ID");
     dIType.ItemNumber = dr.GetString("ItemNumber");
     dIType.Code = dr.GetString("Code");
     dIType.Name = dr.GetString("Name");
     return dIType;
 }
예제 #16
0
        //need to check
        private DisbursementItem FetchDisbursementItemsForSearch(DisbursementItem SearchDisbursementItem, SafeDataReader dr)
        {
            SearchDisbursementItem.ID = dr.GetInt32("ID");
            SearchDisbursementItem.RefID = SearchDisbursementItem.ID;
            SearchDisbursementItem.WOID = dr.GetInt32("WOID");
            SearchDisbursementItem.Code = dr.GetString("Code");
            SearchDisbursementItem.ItemNumber = dr.GetString("ItemNumber");
            SearchDisbursementItem.DiItemToolTip = dr.GetString("DIItemToolTip");
            SearchDisbursementItem.Name = dr.GetString("Name");
            SearchDisbursementItem.Units = dr.GetInt32("Units");
            SearchDisbursementItem.ClientName = dr.GetString("ClientName");
            SearchDisbursementItem.UnitPrice = dr.GetDecimal("UnitPrice");
            SearchDisbursementItem.Amount = dr.GetDecimal("Amount");
            SearchDisbursementItem.WorkOrderNumber = dr.GetString("WOCode").Trim();
            //SearchDisbursementItem.Currency = dr.GetString("Currency");
            SearchDisbursementItem.VenderRefID = dr.GetString("VenderRefId");
            SearchDisbursementItem.DateIncurred = dr.GetString("DateIncurred");
            SearchDisbursementItem.Description = dr.GetString("Description");
            SearchDisbursementItem.NoteCount = dr.GetInt32("NoteCount");
            SearchDisbursementItem.NoteType = dr.GetString("NoteType");

            string toolTip = dr.GetString("Description");
            if (toolTip.Contains("~^"))
            {
                toolTip = toolTip.Replace("~^", Environment.NewLine);
            }
            SearchDisbursementItem.DescriptionToolTip = toolTip;
            int descLength = SearchDisbursementItem.Description.Length;
            if (descLength > 10)
            {
                string strNewDesc = SearchDisbursementItem.Description.Substring(0, 10);
                strNewDesc = strNewDesc + "...";
                SearchDisbursementItem.Description = strNewDesc;
            }

            SearchDisbursementItem.ACCPACStatus = dr.GetInt32("ACCPACStatus");
            SearchDisbursementItem.ACCPACDescription = dr.GetString("ACCPACDescription");
            SearchDisbursementItem.ACCPACExplanation = dr.GetString("Explaination");
            SearchDisbursementItem.IsAdhoc = dr.GetBoolean("IsAdhoc");
            SearchDisbursementItem.IsArchived = dr.GetBoolean("IsArchived");
            SearchDisbursementItem.IsBilled = dr.GetBoolean("IsBilled");
            SearchDisbursementItem.IsVerified = dr.GetBoolean("IsVerified");
            SearchDisbursementItem.CreatedDate = dr.GetDateTime("CreatedDate").ToString("dd MMM yyyy hh:mm:ss tt");

            return SearchDisbursementItem;
        }