Пример #1
0
        public RequestResult InsertConstructSubsidy(
            ConstructInfo ConstructInfo,
            List <Files> Files
            )
        {
            try
            {
                /// Data Validations
                DataValidation.IsEmptyOrDefault2(ConstructInfo);
                DataValidation.IsEmptyOrDefault2(ConstructInfo.CheckedData);
                DataValidation.IsEmptyOrDefault2(ConstructInfo.CharityMainData);
                DataValidation.IsEmptyOrDefaultList2(Files);

                //if (DataValidation.IsEmptyOrDefault(ConstructInfo) ||
                //    DataValidation.IsEmptyOrDefault(ConstructInfo.CheckedData) ||
                //    DataValidation.IsEmptyOrDefault(ConstructInfo.CharityMainData) ||
                //    DataValidation.IsEmptyOrDefaultList(Files))
                //    throw new FaultException<ValidationFault>(new ValidationFault());

                /// Call Database
                using (CharityDAL dal = new CharityDAL(new ADO()))
                {
                    return(dal.InsertConstructSubsidyDAL(
                               ConstructInfo,
                               Files
                               ));
                }
            }
            catch (FaultException <ValidationFault> flex)
            {
                //ValidationFault fault = new ValidationFault
                //{
                //    Result = true,
                //    Message = "Parameter not correct",
                //    Description = "Invalid Parameters is Required but have null or empty or 0 value"
                //};

                //var flex = new FaultException<ValidationFault>(fault, new FaultReason("Invalid Parameters is Required but have null or empty or 0 value"));

                _log.Error(flex);

                throw flex;
            }
            catch (Exception ex)
            {
                ValidationFault fault = new ValidationFault
                {
                    Result      = false,
                    Message     = ex.Message,
                    Description = "Service have an internal error please contact service administartor [email protected]"
                };

                _log.Error(ex);

                throw new FaultException <ValidationFault>(fault);
            }
        }
 public override object GetParameterTypeByIndex(int idx)
 {
     if (idx >= 0)
     {
         ConstructorInfo info = this.ConstructInfo;
         if (info != null)
         {
             ParameterInfo[] ps = ConstructInfo.GetParameters();
             if (ps != null && idx < ps.Length)
             {
                 return(ps[idx]);
             }
         }
     }
     return(null);
 }
        public override object GetParameterType(string name)
        {
            ConstructorInfo info = this.ConstructInfo;

            if (info != null)
            {
                ParameterInfo[] ps = ConstructInfo.GetParameters();
                if (ps != null)
                {
                    for (int i = 0; i < ps.Length; i++)
                    {
                        if (string.Compare(ps[i].Name, name, StringComparison.Ordinal) == 0)
                        {
                            return(ps[i].ParameterType);
                        }
                    }
                }
            }
            return(null);
        }
        public override object GetParameterType(UInt32 id)
        {
            ConstructorInfo info = this.ConstructInfo;

            if (info != null)
            {
                ParameterInfo[] ps  = ConstructInfo.GetParameters();
                int             idi = (int)id;
                if (ps != null)
                {
                    if (ps.Length == 1)
                    {
                        return(ps[0].ParameterType);
                    }
                    for (int i = 0; i < ps.Length; i++)
                    {
                        if (string.IsNullOrEmpty(ps[i].Name))
                        {
                            if (ps[i].ParameterType.GetHashCode() == idi)
                            {
                                return(ps[i].ParameterType);
                            }
                            else if (ps[i].GetHashCode() == idi)
                            {
                                return(ps[i].ParameterType);
                            }
                            else if (ps[i].MetadataToken == idi)
                            {
                                return(ps[i].ParameterType);
                            }
                        }
                        else if (ps[i].Name.GetHashCode() == idi)
                        {
                            return(ps[i].ParameterType);
                        }
                    }
                }
            }
            return(null);
        }
Пример #5
0
        /// <summary>
        /// حفظ بيانات الاعانه الانشائية
        /// </summary>
        /// <param name="cnst"></param>
        /// <param name="Files"></param>
        /// <returns></returns>
        public RequestResult InsertConstructSubsidyDAL(
            ConstructInfo cnst,
            List <Files> Files
            )
        {
            List <SpInPuts> inputs = new List <SpInPuts>
            {
                new SpInPuts()
                {
                    KEY = "P_REG_TYPE_CODE", VALUE = cnst.CheckedData.AgencyType
                },
                new SpInPuts()
                {
                    KEY = "P_REG_ID", VALUE = cnst.CheckedData.AgencyLicenseNumber
                },

                new SpInPuts()
                {
                    KEY = "P_SUBSIDY_CODE", VALUE = cnst.CharityMainData.SubsidyType
                },
                new SpInPuts()
                {
                    KEY = "P_BENEF_COUNT", VALUE = cnst.CharityMainData.BeneficiariesCount
                },
                new SpInPuts()
                {
                    KEY = "P_VOLUNTEERS_COUNT", VALUE = cnst.CharityMainData.VolunteersCount
                },
                new SpInPuts()
                {
                    KEY = "P_EMP_SA_COUNT", VALUE = cnst.CharityMainData.SaudiEmployeesCount
                },
                new SpInPuts()
                {
                    KEY = "P_EMP_NONSA_COUNT", VALUE = cnst.CharityMainData.NonSaudiEmployeesCount
                },
                new SpInPuts()
                {
                    KEY = "P_BALANCE_SHEET_FLG", VALUE = cnst.CharityMainData.IsbudgetIssued
                },
                new SpInPuts()
                {
                    KEY = "P_BOARD_MEET_FLG", VALUE = cnst.CharityMainData.IsBoardOfDirectorsMeetingsRegular
                },
                new SpInPuts()
                {
                    KEY = "P_PUB_BOARD_MEET_FLG", VALUE = cnst.CharityMainData.IsGeneralAssemblyMeetingsRegular
                },
                new SpInPuts()
                {
                    KEY = "P_PUB_BOARD_MEET_REASON", VALUE = cnst.CharityMainData.GeneralAssemblyIrregularityMeetingReason
                },
                new SpInPuts()
                {
                    KEY = "P_LAST_YEAR_EXPENSES", VALUE = cnst.CharityMainData.TotalExpensesAdministrativePreviousYear
                },
                new SpInPuts()
                {
                    KEY = "P_LAST_YEAR_ROG_EXPENSES", VALUE = cnst.CharityMainData.TotalExpensesForActivitiesPreviousYear
                },
                new SpInPuts()
                {
                    KEY = "P_LAST_YEAR_PRG_COUNT", VALUE = cnst.CharityMainData.ProgramsImplementedPreviousYearCount
                },
                new SpInPuts()
                {
                    KEY = "P_MAKEEN_EAVL_RESULT", VALUE = cnst.CharityMainData.GovernmentEvaluationResult
                },

                new SpInPuts()
                {
                    KEY = "P_PROG_NAME", VALUE = cnst.ProgramName
                },
                new SpInPuts()
                {
                    KEY = "P_PROG_AUDIENCES", VALUE = cnst.TargetedPeoples
                },

                new SpInPuts()
                {
                    KEY = "P_PROG_SUMMARY", VALUE = cnst.CharityMainData.BriefAboutEmergencyAssembly
                },

                new SpInPuts()
                {
                    KEY = "P_PROG_GOALS", VALUE = cnst.ProgramGoals
                },
                new SpInPuts()
                {
                    KEY = "P_IMPLEMENTATION_DT", VALUE = cnst.ImplementationDate
                },
                new SpInPuts()
                {
                    KEY = "P_IMPLEMENTATION_DESC", VALUE = cnst.ImplementationMethod
                },
                new SpInPuts()
                {
                    KEY = "P_IMPLEMENTATION_DURATION", VALUE = cnst.ImplementationDuration
                },
                new SpInPuts()
                {
                    KEY = "P_TOTAL_PROG_COST", VALUE = cnst.TotalCost
                },

                new SpInPuts()
                {
                    KEY = "P_PARTNERS_FLAG", VALUE = cnst.CharityMainData.AreTherePartners
                },
                new SpInPuts()
                {
                    KEY = "P_PARTNERS_LIST", VALUE = cnst.CharityMainData.PartnerNames
                },
                new SpInPuts()
                {
                    KEY = "P_PARTNERS_FUND_SUPPORT", VALUE = cnst.CharityMainData.TotalPartnerSupport
                },

                new SpInPuts()
                {
                    KEY = "P_PROG_GOALS_CMPTBL_FLAG", VALUE = cnst.CompatibilityOfProgramsWithObjectives
                },

                new SpInPuts()
                {
                    KEY = "P_PROG_REQUEST_AMOUNT", VALUE = cnst.CharityMainData.RequiredSubsidy
                },

                new SpInPuts()
                {
                    KEY = "P_ORG_FUND_SUPPORT", VALUE = cnst.AllocatedAmountToProject
                },
                new SpInPuts()
                {
                    KEY = "P_ORG_FUND_SUPPORT_PRCNT", VALUE = cnst.AllocatedPercentageToProject
                },

                new SpInPuts()
                {
                    KEY = "P_LOGIN_ID", VALUE = cnst.CheckedData.CommissionerNumber
                }
            };

            List <SpOutPuts> Outouts = new List <SpOutPuts>()
            {
                new SpOutPuts()
                {
                    ParameterName = "P_RESULT_CODE", OracleDbType = OracleDbType.Varchar2, Size = 300
                },
                new SpOutPuts()
                {
                    ParameterName = "P_RESULT_TEXT", OracleDbType = OracleDbType.Varchar2, Size = 2000
                },
                new SpOutPuts()
                {
                    ParameterName = "P_REQUEST_ID", OracleDbType = OracleDbType.Varchar2, Size = 300
                }
            };

            //Populate Parameters
            List <OracleParameter> OpParms = ado.PopulateSpInPuts(
                in inputs
                );

            ado.PopulateSpOutPuts(
                ref OpParms,
                in Outouts
                );

            ado.ExecuteStoredProcedure(
                "CH_P_SUBSIDY_BUILDUP",
                OpParms,
                out OracleParameterCollection OPCs
                );

            RequestResult RequestResult = new RequestResult
            {
                RequestId = OPCs[":P_REQUEST_ID"].Value != null?Convert.ToInt64(OPCs[":P_REQUEST_ID"].Value.ToString()) : 0,
                                RequestCode = OPCs[":P_RESULT_CODE"].Value.ToString(),
                                RequestName = OPCs[":P_RESULT_TEXT"].Value.ToString(),
            };

            for (int i = 0; i < Files.Count(); i++)
            {
                InsertAttachmentDAL(
                    RequestResult.RequestId,
                    Files[i].Id,
                    Files[i].Path,
                    cnst.CheckedData.CommissionerNumber
                    );
            }

            return(RequestResult);
        }