Ejemplo n.º 1
0
        public static int?UserUpdate(User user, int iUserManagerId, int changeEligibility)
        {
            try
            {
                List <SqlParameter> parameters = ObjectGenerator <User> .GetSqlParametersFromObject(user);

                parameters.Add(new SqlParameter("iUserManagerId", iUserManagerId));
                parameters.Add(new SqlParameter("changeEligibility", changeEligibility));
                if (user.lLanguage != null && user.lLanguage.Count != 0)
                {
                    parameters.Add(ObjectGenerator <int> .GenerateSimpleDataTableFromList(user.lLanguage, "int", "lLanguage"));
                }
                if (user.lOrderType != null && user.lOrderType.Count != 0)
                {
                    parameters.Add(ObjectGenerator <int> .GenerateSimpleDataTableFromList(user.lOrderType, "int", "lOrderType"));
                }
                DataSet ds = SqlDataAccess.ExecuteDatasetSP("User_UPD", parameters);
                return(int.Parse(ds.Tables[0].Rows[0][0].ToString()));
            }
            catch (Exception ex)
            {
                Log.ExceptionLog(ex.Message, "UserUpdate");
                return(-1);
            }
        }
Ejemplo n.º 2
0
        public static int?UserInsert(User user, int iUserManagerId, int userType)
        {
            try
            {
                List <SqlParameter> parameters = ObjectGenerator <User> .GetSqlParametersFromObject(user);

                parameters.Add(new SqlParameter("iUserManagerId", iUserManagerId));
                parameters.Add(new SqlParameter("userType", userType));
                if (userType == 3)
                {
                    parameters.Add(ObjectGenerator <int> .GenerateSimpleDataTableFromList(user.lLanguage, "int", "lLanguage"));
                    parameters.Add(ObjectGenerator <int> .GenerateSimpleDataTableFromList(user.lOrderType, "int", "lOrderType"));
                }
                if (userType == 1)
                {
                    user.iEntitlementTypeId = null;
                    user.iCommunicationCart = null;
                }

                DataSet ds = SqlDataAccess.ExecuteDatasetSP("TUser_INS", parameters);
                return(int.Parse(ds.Tables[0].Rows[0][0].ToString()));
            }
            catch (Exception ex)
            {
                Log.ExceptionLog(ex.Message, "UserInsert");
                return(-1);
            }
        }
Ejemplo n.º 3
0
        public static User Login(string nvUserName, string nvPassword)
        {
            try
            {
                SqlParameter[] param =
                {
                    new SqlParameter("nvUserName", nvUserName),
                    new SqlParameter("nvPassword", nvPassword)
                };
                DataSet ds = SqlDataAccess.ExecuteDatasetSP("TUser_Login", param);
                if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    User user = ObjectGenerator <User> .GeneratFromDataRow(ds.Tables[0].Rows[0]);

                    return(user);
                }
                return(new User {
                    iUserId = -1
                });
            }
            catch (Exception ex)
            {
                Log.ExceptionLog(ex.Message, "Login");
                return(null);
            }
        }
Ejemplo n.º 4
0
 public static List <CategoryItem> GetCategoryItems(int iCatTypeId, int?iCatItemParentId, int?iCatItemParentId2)
 {
     try
     {
         List <CategoryItem> categoryItems = new List <CategoryItem>();
         DataRowCollection   drc           = SqlDataAccess.ExecuteDatasetSP("TCategoryItem2_SLCT", new List <SqlParameter>()
         {
             new SqlParameter("iCatTypeId", iCatTypeId),
             new SqlParameter("iCatItemParentId", iCatItemParentId),
             new SqlParameter("iCatItemParentId2", iCatItemParentId2)
         }).Tables[0].Rows;
         foreach (DataRow dr in drc)
         {
             categoryItems.Add(ObjectGenerator <CategoryItem> .GeneratFromDataRow(dr));
         }
         //var jsonText = File.ReadAllText(ConfigSettings.ReadSetting("DataFile"));
         //var result = JsonConvert.DeserializeObject<List<CategoryItem>>(jsonText);
         //if (iCatTypeId == 4 && iCatItemParentId == 0)
         //	categoryItems = result.Where(x => x.iCatTypeId == 4 && x.iCatItemGrandParentId == iCatItemParentId2).ToList();
         //else
         //	categoryItems = result.Where(x => x.iCatTypeId == iCatTypeId && x.iCatItemParentId == iCatItemParentId).ToList();
         return(categoryItems);
     }
     catch (Exception ex)
     {
         Log.LogError("GetCategoryItems / TCategoryItem_SLCT",
                      "iCatItemParentId = " + iCatItemParentId +
                      ", exception = " + ex);
         return(null);
     }
 }
Ejemplo n.º 5
0
        public static string RefundUpdate(Refund refund, int iUserManagerId, bool isDelete, double prevRefund)
        {
            try
            {
                if (refund.nvDocPath != null)
                {
                    if (isDelete == false)
                    {
                        if (refund.nvDocPath.Split(':')[0] == "data")
                        {
                            refund.nvDocPath = new FileManageCtrl().SaveFile(refund.nvDocPath.Substring(refund.nvDocPath.LastIndexOf(",") + 1), "reference", refund.nvDocPath.Substring(refund.nvDocPath.IndexOf('/') + 1, refund.nvDocPath.LastIndexOf(';') - refund.nvDocPath.IndexOf('/') - 1), iUserManagerId);
                        }
                    }
                    else
                    {
                        refund.nvDocPath = refund.nvDocPath.Split('/')[4];
                        new FileManageCtrl().DeleteFile(refund.nvDocPath, "reference");
                        refund.nvDocPath = null;
                    }
                }
                List <SqlParameter> parameters = ObjectGenerator <Refund> .GetSqlParametersFromObject(refund);

                parameters.Add(new SqlParameter("iUserManagerId", iUserManagerId));
                parameters.Add(new SqlParameter("prevRefund", prevRefund));
                DataSet ds = SqlDataAccess.ExecuteDatasetSP("TRefund_UPD", parameters);
                return("success");
            }
            catch (Exception ex)
            {
                Log.ExceptionLog(ex.Message, "RefundUpdate");
                return(null);
            }
        }
Ejemplo n.º 6
0
 public static List <KeyValue <int, string> > GetUsersCode(int?iUserType, int iStatusId, int?iTypeTranslation)
 {
     try
     {
         List <SqlParameter> parameters = new List <SqlParameter>();
         parameters.Add(new SqlParameter("iUserType", iUserType));
         parameters.Add(new SqlParameter("iStatusId", iStatusId));
         parameters.Add(new SqlParameter("iTypeTranslation", iTypeTranslation));
         //data set שולף אוסף של טבלאות
         DataTable dt = SqlDataAccess.ExecuteDatasetSP("TUserCode_SLCT", parameters).Tables[0];
         List <KeyValue <int, string> > lusersCode = new List <KeyValue <int, string> >();
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             KeyValue <int, string> userCode = new KeyValue <int, string>();
             userCode.iId    = int.Parse(dt.Rows[i]["iId"].ToString());
             userCode.nvName = dt.Rows[i]["nvName"].ToString();
             lusersCode.Add(userCode);
         }
         return(lusersCode);
     }
     catch (Exception ex)
     {
         Log.ExceptionLog(ex.Message, "GetUsersCode");
         return(null);
     }
 }
Ejemplo n.º 7
0
        public static twoList RecommendationAll()
        {
            twoList res = new twoList()
            {
                recommendations1 = new List <Recommendation>(),
                recommendations2 = new List <Recommendation>()
            };

            try
            {
                DataSet ds = SqlDataAccess.ExecuteDatasetSP("All_Recommendation_SLCT");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    res.recommendations1 = ObjectGenerator <Recommendation> .GeneratListFromDataRowCollection(ds.Tables[0].Rows);

                    res.recommendations2 = ObjectGenerator <Recommendation> .GeneratListFromDataRowCollection(ds.Tables[1].Rows);
                }
                return(res);
            }
            catch (Exception x)
            {
                Log.LogError("RecommendationAll", x.Message);
                res = null;
                return(res);
            }
        }
Ejemplo n.º 8
0
        public static bool UpdateStudent(Student student, string base64Image, int iUserId)
        {
            try
            {
                if (base64Image != "")
                {
                    student.nvImgStudent = Fileshandler.SaveFileByBase64(base64Image, student.nvImgStudent, "Students//");
                    DataRow dr       = SqlDataAccess.ExecuteDatasetSP("TStudentGetStudentbyId_SLCT", new SqlParameter("iPersonId", student.iPersonId)).Tables[0].Rows[0];
                    string  prevName = ObjectGenerator <Student> .GeneratFromDataRow(dr).nvImgStudent;

                    if (prevName != "")
                    {
                        Fileshandler.DeleteFile(prevName, "Students//");
                    }
                }

                List <SqlParameter> parameters = ObjectGenerator <Student> .GetSqlParametersFromObject(student);

                parameters.Add(new SqlParameter("iUserId", iUserId));
                SqlDataAccess.ExecuteDatasetSP("TStudent_UPD", parameters);
                return(true);
            }
            catch (Exception ex)
            {
                Log.LogError("UpdateStudent / TStudent_UPD", "ex" + ex);
                return(false);
            }
        }
Ejemplo n.º 9
0
        //להוסיף iPersonId
        //של היוזר ולשלוף את המשתתפים לפיו
        public static List <Person> GetParticipantsList(int iEventId)
        {
            try
            {
                DataTable     dt           = SqlDataAccess.ExecuteDatasetSP("TParticipant_GetParticipantByEventId_SLCT", new SqlParameter("iEventId", iEventId)).Tables[0];
                List <Person> participants = new List <Person>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Person p = new Person();
                    p.nvLastName  = dt.Rows[i]["nvLastName"].ToString();
                    p.nvFirstName = dt.Rows[i]["nvFirstName"].ToString();
                    p.nvPhone     = dt.Rows[i]["nvPhone"].ToString();
                    p.nvMobile    = dt.Rows[i]["nvMobile"].ToString();
                    p.nvEmail     = dt.Rows[i]["nvEmail"].ToString();
                    p.lstObject.Add("iArrivalStatusType", dt.Rows[i]["iArrivalStatusType"].ToString());
                    p.lstObject.Add("nvParticipantType", dt.Rows[i]["nvParticipantType"].ToString());

                    participants.Add(p);
                }

                return(participants);
            }
            catch (Exception ex)
            {
                Log.LogError("GetParticipantsList / TParticipant_SLCT", "ex" + ex + ", iEventId : " + iEventId);
                return(null);
            }
        }
Ejemplo n.º 10
0
 public static List <Settings> GetHMOs()
 {
     try
     {
         List <Settings> HMOs = new List <Settings>();
         DataSet         ds   = SqlDataAccess.ExecuteDatasetSP("TLink_HMO_SLCT");
         if (ds != null && ds.Tables[0].Rows.Count > 0)
         {
             for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
             {
                 HMOs.Add(new Settings()
                 {
                     iSettingId = int.Parse(ds.Tables[0].Rows[i]["iSysTableConId"].ToString()),
                     nvSetting  = ds.Tables[0].Rows[i]["nvValue"].ToString()
                 });
             }
         }
         return(HMOs);
     }
     catch (Exception x)
     {
         Log.LogError("GetHMOs", x.Message);
         return(null);
     }
 }
Ejemplo n.º 11
0
 public static int NewVideoTranslation(DateTime dtTimeBegin, DateTime dtTimeTranslation, string nvTranslatorIdentity, string nvUserIdentity)
 {
     try
     {
         List <SqlParameter> lParams = new List <SqlParameter>()
         {
             new SqlParameter("dtTimeBegin", dtTimeBegin),
             new SqlParameter("dtTimeTranslation", dtTimeTranslation),
             new SqlParameter("nvTranslatorIdentity", nvTranslatorIdentity),
             new SqlParameter("nvUserIdentity", nvUserIdentity)
         };
         DataSet ds = SqlDataAccess.ExecuteDatasetSP("TOrder_Video_INS", lParams);
         if (ds.Tables[0].Rows.Count > 0)
         {
             int iOrderId = int.Parse(ds.Tables[0].Rows[0][0].ToString());
             return(iOrderId);
         }
         return(0);
     }
     catch (Exception e)
     {
         Log.ExceptionLog(e.Message, "NewVideoTranslation");
         return(-1);
     }
 }
Ejemplo n.º 12
0
        //public static List<Document> GetImage()
        //{
        //    {
        //        try
        //        {
        //            List<Document> documents = new List<Document>();
        //            DataRowCollection drc = SqlDataAccess.ExecuteDatasetSP("TDocuments_OfIMAGE_SLCT").Tables[0].Rows;
        //            foreach (DataRow dr in drc)
        //            {
        //                documents.Add(ObjectGenerator<Document>.GeneratFromDataRow(dr));

        //            }
        //            return documents;
        //        }
        //        catch (Exception ex)
        //        {
        //            Log.LogError("GetDocuments / TDocuments_OfStudents_SLCT", ", ex " + ex);
        //            return null;
        //        }



        public static int SetDocument(Document document, string nvBase64File, int iUserId)
        {
            try
            {
                if (nvBase64File != "")
                {
                    document.nvDocumentName = Fileshandler.SaveFileByBase64(nvBase64File, document.nvDocumentName);
                    if (document.iDocumentId != 0)
                    {
                        DataRow dr       = SqlDataAccess.ExecuteDatasetSP("TDocuments_ByDocumentId_SLCT", new SqlParameter("iDocumentId", document.iDocumentId)).Tables[0].Rows[0];
                        string  prevName = ObjectGenerator <Document> .GeneratFromDataRow(dr).nvDocumentName;

                        Fileshandler.DeleteFile(prevName);
                    }
                }
                List <SqlParameter> sqlParameters = ObjectGenerator <Document> .GetSqlParametersFromObject(document);

                sqlParameters.Add(new SqlParameter("iUserId", iUserId));

                var dtCreatedate = sqlParameters.Where(s => s.ParameterName.Equals("dtCreatedate")).FirstOrDefault();
                sqlParameters.Remove(dtCreatedate);
                //SqlDataAccess.ExecuteDatasetSP("TDocuments_INS/UPD", sqlParameters);

                //return true;

                int id = int.Parse(SqlDataAccess.ExecuteDatasetSP("TDocuments_INS/UPD", sqlParameters).Tables[0].Rows[0][0].ToString());
                return(id);
            }
            catch (Exception ex)
            {
                Log.LogError("SetDocument /TDocuments_INS/upd", "ex: " + ex);
                return(0);
            }
        }
Ejemplo n.º 13
0
        public static Dictionary <string, List <CodeTable> > GetListCodeTables(string sProcName, List <SqlParameter> parameters = null)
        {
            try
            {
                DataSet ds;
                if (parameters != null)
                {
                    ds = SqlDataAccess.ExecuteDatasetSP(sProcName, parameters);
                }
                else
                {
                    ds = SqlDataAccess.ExecuteDatasetSP(sProcName);
                }
                Dictionary <string, List <CodeTable> > codeTables = new Dictionary <string, List <CodeTable> >();
                for (int i = 0; i < ds.Tables.Count; i++)
                {
                    codeTables.Add(ds.Tables[i++].Rows[0][0].ToString(), ObjectGenerator <CodeTable> .GeneratListFromDataRowCollection(ds.Tables[i].Rows));
                }
                return(codeTables);
            }

            catch (Exception ex)
            {
                Log.ExceptionLog(ex.Message, "GetListCodeTables" + " , sProcName:" + sProcName);
                return(null);
            }
        }
Ejemplo n.º 14
0
 public static User Login(string nvUserName, string nvPassword)
 {
     try
     {
         List <SqlParameter> parameters = new List <SqlParameter>();
         parameters.Add(new SqlParameter("nvUserName", nvUserName));
         parameters.Add(new SqlParameter("nvPassword", nvPassword));
         DataRow dr;
         DataSet ds = SqlDataAccess.ExecuteDatasetSP("TUser_ByUserNameAndPassword_SLCT", parameters);
         if (ds.Tables[0].Rows.Count != 0)
         {
             dr = ds.Tables[0].Rows[0];
         }
         else
         {
             dr = null;
         }
         User user;
         if (dr != null)
         {
             return(ObjectGenerator <User> .GeneratFromDataRow(dr));
         }
         return(null);
     }
     catch (Exception ex)
     {
         Log.LogError("Login / TUser_ByUserNameAndPassword_SLCT", "nvUserName: "******", nvPassword:"******", ex " + ex);
         return(null);
     }
 }
Ejemplo n.º 15
0
        public static List <UserBasic> GetUsersBasic(int?iUserType)
        {
            try
            {
                DataSet ds = SqlDataAccess.ExecuteDatasetSP("TSysUserBasic_SLCT", new SqlParameter("iUserType", iUserType));

                List <UserBasic> lUsers = new List <UserBasic>();
                DataView         dv;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    UserBasic user = new UserBasic();
                    user = ObjectGenerator <UserBasic> .GeneratFromDataRow(dr);

                    dv = new DataView(ds.Tables[1],
                                      "iUserId = " + user.iUserId.ToString(),
                                      "", DataViewRowState.CurrentRows);
                    user.lOrderType = new List <int>();
                    for (int j = 0; j < dv.Count; j++)
                    {
                        user.lOrderType.Add(int.Parse(dv[j]["iTypeId"].ToString()));
                    }
                    lUsers.Add(user);
                }
                return(lUsers);
            }
            catch (Exception ex)
            {
                Log.ExceptionLog(ex.Message, "GetUsersBasic");
                return(null);
            }
        }
Ejemplo n.º 16
0
        public static ResObject <List <Contact> > GeContacts(string nvGuide)
        {
            ResObject <List <Contact> > res = new ResObject <List <Contact> >();

            try
            {
                List <Contact> contacts = new List <Contact>();
                DataSet        ds       = SqlDataAccess.ExecuteDatasetSP("TContact_SLCT",
                                                                         new SqlParameter("nvGuide", nvGuide));
                if (ds.Tables[0].Rows[0][0].ToString() != string.Empty && int.Parse(ds.Tables[0].Rows[0][0].ToString()) < 0)
                {
                    res.Error  = new ErrorObj(StatusCode.UserUnauthorized);
                    res.Result = null;
                    return(res);
                }
                if (ds != null && ds.Tables[1].Rows.Count > 0)
                {
                    contacts = ObjectGenerator <Contact> .GeneratListFromDataRowCollection(ds.Tables[1].Rows);
                }
                res.Error  = new ErrorObj(StatusCode.Success);
                res.Result = contacts;
                return(res);
            }
            catch (Exception x)
            {
                Log.LogError("GeContacts", x.Message);
                res.Error  = new ErrorObj(StatusCode.Error, x.Message);
                res.Result = null;
                return(res);
            }
        }
Ejemplo n.º 17
0
 public static List <Product> GetProduct()
 {
     try
     {
         DataTable      dt        = SqlDataAccess.ExecuteDatasetSP("TSysProduct_SLCT").Tables[0];
         List <Product> lProducts = new List <Product>();
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             Product product = new Product();
             product.iProductId = int.Parse(dt.Rows[i]["iProductId"].ToString());
             if (dt.Rows[i]["iProductTypeId"].ToString() != string.Empty)
             {
                 product.iProductTypeId = int.Parse(dt.Rows[i]["iProductTypeId"].ToString());
             }
             product.nvPruductName   = dt.Rows[i]["nvPruductName"].ToString();
             product.nvProductTypeId = dt.Rows[i]["nvProductTypeId"].ToString();
             lProducts.Add(product);
         }
         return(lProducts);
     }
     catch (Exception ex)
     {
         Log.ExceptionLog(ex.Message, "GetProduct");
         return(null);
     }
 }
Ejemplo n.º 18
0
 public static int NewRecommendationPhone(string nvHMO, string nvCity, string nvClinic, string nvDoctorName, string nvRecommendation, string nvFirstName, string nvMobile)
 {
     try
     {
         Log.LogInfo("recommendationPhone name: " + nvFirstName);
         List <SqlParameter> parameters = new List <SqlParameter>()
         {
             new SqlParameter("nvHMO", nvHMO),
             new SqlParameter("nvCity", nvCity),
             new SqlParameter("nvClinic", nvClinic),
             new SqlParameter("nvDoctorName", nvDoctorName),
             new SqlParameter("nvRecommendation", nvRecommendation),
             new SqlParameter("nvMobile", nvMobile),
             new SqlParameter("nvFirstName", nvFirstName)
         };
         DataSet ds = SqlDataAccess.ExecuteDatasetSP("TRecommendationPhone_INS", parameters);
         int     iRecommendationId = 0;
         if (ds != null && ds.Tables[0].Rows.Count > 0)
         {
             iRecommendationId = int.Parse(ds.Tables[0].Rows[0][0].ToString());
         }
         return(iRecommendationId);
     }
     catch (Exception ex)
     {
         Log.LogError("NewRecommendationPhone / TRecommendationPhone_INS",
                      ", exception = " + ex);
         return(-1);
     }
 }
Ejemplo n.º 19
0
        public static bool SetEvent(Event1 oEvent, int iUserId, List <TInt> to)
        {
            try
            {
                bool isNew;
                isNew = oEvent.iEventId == 0 ? true : false;
                List <SqlParameter> parameters = new List <SqlParameter>();
                parameters.Add(new SqlParameter("iEventId", oEvent.iEventId));
                parameters.Add(new SqlParameter("nvName", oEvent.nvName));
                parameters.Add(new SqlParameter("dtEventDate", oEvent.dtEventDate));
                parameters.Add(new SqlParameter("nvPlace", oEvent.nvPlace));
                parameters.Add(new SqlParameter("nvComments", oEvent.nvComments));
                parameters.Add(new SqlParameter("iUserId", iUserId));
                parameters.Add(new SqlParameter("participantIds", ObjectGenerator <TInt> .GetDataTable(to)));


                if (!isNew)
                {
                    SqlDataAccess.ExecuteDatasetSP("TEvent_INS/UPD", parameters);
                }
                if (isNew)
                {
                    User user             = User.GetUser(iUserId);
                    DataRowCollection drc = SqlDataAccess.ExecuteDatasetSP("TEvent_INS/UPD", parameters).Tables[0].Rows;
                    for (int i = 0; i < drc.Count; i++)
                    {
                        int    iPersonId = int.Parse(drc[i]["iPersonId"].ToString());
                        string nvEmail   = drc[i]["nvEmail"].ToString();
                        string body      = "<b>הנך מוזמן ל" + oEvent.nvName +
                                           "</b><br>שיתקיים ב" + oEvent.nvPlace +
                                           "<br>בתאריך " + oEvent.dtEventDate + "<br>" + oEvent.nvComments +
                                           "<br><br> <b> בברכה </b> <br>" + user.nvFirstName + " " + user.nvLastName +
                                           "<br> עמותת ונתנו ידידים";
                        string from = user.nvEmail;
                        if (user.nvEmail == "" || user.nvEmail == null)
                        {
                            from = ConfigSettings.ReadSetting("Email");
                        }
                        if (SendMessagesHandler.SendEmailOrFax(from, nvEmail, oEvent.nvName, body, null) == true)
                        {
                            List <SqlParameter> param = new List <SqlParameter>();
                            param.Add(new SqlParameter("iEventId", drc[i]["iEventId"]));
                            param.Add(new SqlParameter("iPersonId", iPersonId));
                            param.Add(new SqlParameter("iStatusType", 34));  //סטטוס קיבל הודעה
                            SqlDataAccess.ExecuteDatasetSP("TParticipantsUpdateArrivalStatus_UPD", param);
                        }
                    }
                    //SendMessagesHandler.SendEmailOrFax()
                }


                return(true);
            }
            catch (Exception ex)
            {
                Log.LogError("set event / TEvent_INS/UPD", "ex" + ex);
                return(false);
            }
        }
Ejemplo n.º 20
0
 public static void ExceptionLog(string exception, string function)
 {
     SqlParameter[] param =
     {
         new SqlParameter("nvException", exception),
         new SqlParameter("nvFunction",  function)
     };
     SqlDataAccess.ExecuteDatasetSP("TSysLog_INS", param);
 }
Ejemplo n.º 21
0
 public static void YearOfRenewalUpdate()
 {
     try
     {
         SqlDataAccess.ExecuteDatasetSP("TYearOfRenewal_UPD");
         Log.ExceptionLog("I enter", "YearOfRenewalUpdate");
     }
     catch (Exception ex)
     {
         Log.ExceptionLog(ex.Message, "YearOfRenewalUpdate");
     }
 }
Ejemplo n.º 22
0
 public static bool DeleteAvrech(int iPersonId)
 {
     try
     {
         SqlDataAccess.ExecuteDatasetSP("TAvrech_DEL", new SqlParameter("iPersonId", iPersonId));
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 23
0
 public static bool DeleteAvrechStudent(int iAvrechId, int iStudentId)
 {
     try
     {
         SqlDataAccess.ExecuteDatasetSP("TAvrechStudents_DEL", new SqlParameter("iAvrechId", iAvrechId), new SqlParameter("iStudentId", iStudentId));
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 24
0
 public static List <SysTableRow> GetSysTables()
 {
     try
     {
         DataTable dt = SqlDataAccess.ExecuteDatasetSP("TSysTables_SLCT").Tables[0];
         return(ObjectGenerator <SysTableRow> .GeneratListFromDataRowCollection(dt.Rows));
     }
     catch (Exception ex)
     {
         Log.ExceptionLog(ex.Message, "GetSysTables");
         return(null);
     }
 }
Ejemplo n.º 25
0
 public static string BankHoursUpdate()
 {
     try
     {
         SqlDataAccess.ExecuteDatasetSP("TBankHours_UPD");
         return("OK");
     }
     catch (Exception ex)
     {
         Log.ExceptionLog(ex.Message, "BankHoursUpdate");
         return(null);
     }
 }
Ejemplo n.º 26
0
        public static Year GetYear(int iYearId, bool bCategoryItem = true)
        {
            try
            {
                DataTableCollection dtc = SqlDataAccess.ExecuteDatasetSP("TYear_ById_SLCT", new List <SqlParameter>()
                {
                    new SqlParameter("iYearId", iYearId),
                    new SqlParameter("bCategoryItem", bCategoryItem)
                }).Tables;

                if (dtc[0].Rows.Count == 0)
                {
                    return(null);
                }

                Year year = ObjectGenerator <Year> .GeneratFromDataRow(dtc[0].Rows[0]);

                List <CategoryItem> lCategoryItem = new List <CategoryItem>();
                if (bCategoryItem)
                {
                    foreach (DataRow dr in dtc[2].Rows)
                    {
                        lCategoryItem.Add(ObjectGenerator <CategoryItem> .GeneratFromDataRow(dr));
                    }
                }

                List <CategoryType> lCategoryType = new List <CategoryType>();
                foreach (DataRow dr in dtc[1].Rows)
                {
                    lCategoryType.Add(ObjectGenerator <CategoryType> .GeneratFromDataRow(dr));
                    lCategoryType.Last().lCategoryItem = lCategoryItem.Where(ci => ci.iCatTypeId == lCategoryType.Last().iCatTypeId).ToList();
                }

                foreach (CategoryType ct in lCategoryType)
                {
                    CategoryType cat = lCategoryType.Where(c => c.iCatTypeId == ct.iCatTypeParentId).FirstOrDefault();
                    if (cat != null)
                    {
                        cat.lCategoryType.Add(ct);
                    }
                }
                year.lCategoryType = lCategoryType.Where(c => c.iCatTypeParentId == 0).ToList();

                return(year);
            }
            catch (Exception ex)
            {
                Log.LogError("GetYear / TYear_SLCT", "iYearId = " + iYearId + ", exception = " + ex);
                return(null);
            }
        }
Ejemplo n.º 27
0
 public static List <SysTables> GetAllNames()
 {
     try
     {
         DataTable         dt  = SqlDataAccess.ExecuteDatasetSP("TSysTables_SLCT").Tables[0];
         DataRowCollection drc = dt.Rows;
         return(ObjectGenerator <SysTables> .GeneratListFromDataRowCollection(drc));
     }
     catch (Exception ex)
     {
         Log.LogError("GetAllNames / TSysTables_SLCT", ", ex " + ex);
         return(null);
     }
 }
Ejemplo n.º 28
0
 public static List <TGlobalParameters> GetGlobalParameters()
 {
     try
     {
         DataTable         dt  = SqlDataAccess.ExecuteDatasetSP("TGlobalParameters_SLCT").Tables[0];
         DataRowCollection drc = dt.Rows;
         return(ObjectGenerator <TGlobalParameters> .GeneratListFromDataRowCollection(drc));
     }
     catch (Exception ex)
     {
         Log.LogError("SaveGlobalParameters / TGlobalParameters_SLCT", ", ex " + ex);
         return(null);
     }
 }
Ejemplo n.º 29
0
        public static bool AddYeshiva(Yeshivot yeshiva)
        {
            try
            {
                List <SqlParameter> parameters = ObjectGenerator <Yeshivot> .GetSqlParametersFromObject(yeshiva);

                DataRow dr = SqlDataAccess.ExecuteDatasetSP("TYeshivot_INS", parameters).Tables[0].Rows[0];
                return(true);
            }
            catch (Exception ex)
            {
                Log.LogError("AddYeshiva / TYeshivot_INS", "ex" + ex + ", yeshiva: " + JsonConvert.SerializeObject(yeshiva));
                return(false);
            }
        }
Ejemplo n.º 30
0
        public static List <Yeshivot> GetAllYeshivot()
        {
            try
            {
                DataRowCollection drc       = SqlDataAccess.ExecuteDatasetSP("TYeshivot_SLCT").Tables[0].Rows;
                List <Yeshivot>   yeshivots = ObjectGenerator <Yeshivot> .GeneratListFromDataRowCollection(drc);

                return(yeshivots);
            }
            catch (Exception ex)
            {
                Log.LogError("GetAllYeshivot / TYeshivot_SLCT", "ex: " + ex);
                return(null);
            }
        }