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); } }
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); } }
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); } }
public static ResObject <List <CategoryItem> > GetCategoryItemsDoctors(string nvGuide) { ResObject <List <CategoryItem> > res = new ResObject <List <CategoryItem> >(); try { List <CategoryItem> categoryItems = new List <CategoryItem>(); DataSet ds = Utilities.SqlDataAccess.ExecuteDatasetSP("TCategoryItem_Doctors_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); } foreach (DataRow dr in ds.Tables[1].Rows) { categoryItems.Add(ObjectGenerator <CategoryItem> .GeneratFromDataRow(dr)); } res.Error = new ErrorObj(StatusCode.Success); res.Result = categoryItems; return(res); } catch (Exception ex) { Log.LogError("GetCategoryItemsDoctors / TCategoryItem_Doctors_SLCT", "exception = " + ex); res.Error = new ErrorObj(StatusCode.Error, ex.Message); res.Result = null; return(res); } }
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); } }
//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); } }
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); } }
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); } }
public static Yeshivot getYeshivaById(int iYeshivaId) { try { DataRow dr = SqlDataAccess.ExecuteDatasetSP("TYeshivot_getById_SLCT", new SqlParameter("iYeshivaId", iYeshivaId)).Tables[0].Rows[0]; Yeshivot yeshiva = ObjectGenerator <Yeshivot> .GeneratFromDataRow(dr); return(yeshiva); } catch (Exception ex) { Log.LogError("getYeshivaById / TYeshivot_getById_SLCT", "ex: " + ex); return(null); } }
public static Person GetPerson(int iPersonId) { try { DataRow dr = SqlDataAccess.ExecuteDatasetSP("TPerson_GetPersonById_SLCT", new SqlParameter("iPersonId", iPersonId)).Tables[0].Rows[0]; Person person = ObjectGenerator <User> .GeneratFromDataRow(dr); return(person); } catch (Exception ex) { Log.LogError("GetPersonById / TPerson_GetPersonById", "iPersonId" + iPersonId + ", ex " + ex); return(null); } }
public static User GetUser(int iPersonId) { try { DataRow dr = SqlDataAccess.ExecuteDatasetSP("TUser_GetUser_SLCT", new SqlParameter("iPersonId", iPersonId)).Tables[0].Rows[0]; User user = ObjectGenerator <User> .GeneratFromDataRow(dr); return(user); } catch (Exception ex) { Log.LogError("GetUser / TUser_GetUser_SLCT", "iPersonId: " + iPersonId + ", ex " + ex); return(null); } }
public static Event1 GetEvent(int?iEventId) { try { DataRow dr = SqlDataAccess.ExecuteDatasetSP("TEvent_GetEvent_SLCT", new SqlParameter("iEventId", iEventId)).Tables[0].Rows[0]; Event1 e = ObjectGenerator <Event1> .GeneratFromDataRow(dr); return(e); } catch (Exception ex) { Log.LogError("GetEvent / TEvent_GetEvent_SLCT", "ex" + ex); return(null); } }
public static ResObject <List <Dashboard> > RecommendationDashboard(int iUserId, string nvGuide) { ResObject <List <Dashboard> > res = new ResObject <List <Dashboard> >(); try { List <Dashboard> dashboard = new List <Dashboard>(); DataSet ds = SqlDataAccess.ExecuteDatasetSP("TRecommendation_Dashboad", new SqlParameter("iUserId", iUserId), 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.Tables[1].Rows.Count > 0) { foreach (DataRow item in ds.Tables[1].Rows) { Dashboard dash = ObjectGenerator <Dashboard> .GeneratFromDataRow(item); dash.source = new intInt(); Dashboard d = dashboard.Where(h => h.name == dash.name).FirstOrDefault(); if (d != null) { d.data += dash.data; } else { dashboard.Add(dash); } } } res.Error = new ErrorObj(StatusCode.Success); res.Result = new List <Dashboard>(); res.Result = dashboard; return(res); } catch (Exception x) { Log.LogError("RecommendationDashboard", x.Message); res.Error = new ErrorObj(StatusCode.Error, x.Message); res.Result = null; return(res); } }
public static Student GetStudentById(int iPersonId) { try { DataRow drc = SqlDataAccess.ExecuteDatasetSP("TStudentGetStudentbyId_SLCT", new SqlParameter("iPersonId", iPersonId)).Tables[0].Rows[0]; Student student = ObjectGenerator <Student> .GeneratFromDataRow(drc); return(student); } catch (Exception ex) { Log.LogError("GetStudentList / TStudentGetStudentbyId_SLCT", "ex" + ex); return(null); } }
public static List <User> GetUsers(int iUserId) { try { //data set שולף אוסף של טבלאות DataSet ds = SqlDataAccess.ExecuteDatasetSP("TSysUser_SLCT", new SqlParameter("iUserId", iUserId)); List <User> lUsers = new List <User>(); DataView dv; //מעבר על כל שורה מתוך הטבלה הראשונה שבאוסף foreach (DataRow dr in ds.Tables[0].Rows) { User user = new User(); //הפיכת כל יוזר לפריט בליסט user = ObjectGenerator <User> .GeneratFromDataRow(dr); //יצירת הטבלה השניה כדינאמית שמחזירה רק שורות התואמות לתנאי מסוים dv = new DataView(ds.Tables[1], "iUserId = " + user.iUserId.ToString(), "", DataViewRowState.CurrentRows); //הכנסת הערכים מהטבלה השניה לתוך הליסט המתאים להם באובייקט //user.lLanguage = ObjectGenerator<int>.GeneratListFromDataRowCollection(dv.ToTable().Rows); user.lLanguage = new List <int>(); for (int j = 0; j < dv.Count; j++) { user.lLanguage.Add(int.Parse(dv[j]["iTypeId"].ToString())); } dv = new DataView(ds.Tables[2], "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, "GetUsers"); return(null); } }
public static List <CategoryItem> GetAllCategoryItems() { try { List <CategoryItem> categoryItems = new List <CategoryItem>(); DataSet dt = SqlDataAccess.ExecuteDatasetSP("TCategoryItem_SLCT_All"); foreach (DataRow dr in dt.Tables[0].Rows) { categoryItems.Add(ObjectGenerator <CategoryItem> .GeneratFromDataRow(dr)); } return(categoryItems); } catch (Exception ex) { Log.LogError("GetAllCategoryItems / TCategoryItem_SLCT_Al " + ex); return(null); } }
public static Avrech GetAvrechById(int?iPersonId) { try { DataRow dr = SqlDataAccess.ExecuteDatasetSP("TAvrech_GetAvrechById_SLCT", new SqlParameter("iPersonId", iPersonId)).Tables[0].Rows[0]; Avrech avrech = ObjectGenerator <Avrech> .GeneratFromDataRow(dr); avrech.lstObject = new Dictionary <string, string>(); avrech.lstObject.Add("nvUserName", dr["nvUserName"].ToString()); avrech.lstObject.Add("nvPassword", dr["nvPassword"].ToString()); return(avrech); } catch (Exception ex) { Log.LogError("GetAvrechim / TAvrech_SLCT", ", ex " + ex); return(null); } }
public static List <Document> GetDocumentsByItemId(int iItemId) { try { List <Document> documents = new List <Document>(); DataRowCollection drc = SqlDataAccess.ExecuteDatasetSP("TDocuments_ByItemId_SLCT", new SqlParameter("iItemId", iItemId)).Tables[0].Rows; foreach (DataRow dr in drc) { documents.Add(ObjectGenerator <Document> .GeneratFromDataRow(dr)); documents.Last().lstObject = new Dictionary <string, string>(); documents.Last().lstObject.Add("nvCategory", dr["nvCategory"].ToString()); } return(documents); } catch (Exception ex) { Log.LogError("GetDocumentsByItemId / TDocuments_ByItemId_SLCT", ", ex " + ex); return(null); } }
public static List <Conversation> GetConversations(int?iPersonId) { try { DataRowCollection drc = SqlDataAccess.ExecuteDatasetSP("TConversation_SLCT", new SqlParameter("iPersonId", iPersonId)).Tables[0].Rows; List <Conversation> conversations = new List <Conversation>(); foreach (DataRow dr in drc) { conversations.Add(ObjectGenerator <Conversation> .GeneratFromDataRow(dr)); conversations.Last().lstObject.Add("nvLastName", dr["nvLastName"].ToString()); conversations.Last().lstObject.Add("nvFirstName", dr["nvFirstName"].ToString()); } //List<Conversation> conversations = ObjectGenerator<Conversation>.GeneratListFromDataRowCollection(dt); return(conversations); } catch (Exception ex) { Log.LogError("GetStudentConversation / TConversation_SLCT", "ex" + ex + ", iPersonId: " + iPersonId); return(null); } }
public static ResObject <List <Recommendation> > GetRecommendationsNewDoctors(int iYearId, string nvGuide) { ResObject <List <Recommendation> > res = new ResObject <List <Recommendation> >(); try { DataSet ds = SqlDataAccess.ExecuteDatasetSP("TRecommendation_New_SLCT", new SqlParameter("iYearId", iYearId), new SqlParameter("nvGuide", nvGuide)); List <Recommendation> recommendations = new List <Recommendation>(); 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.Tables[1].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[1].Rows) { recommendations.Add(ObjectGenerator <Recommendation> .GeneratFromDataRow(dr)); recommendations.Last().lObject.Add("nvCatItemName1", dr["nvCatItemName1"].ToString()); recommendations.Last().lObject.Add("nvCatItemName2", dr["nvCatItemName2"].ToString()); recommendations.Last().lObject.Add("nvCatItemName3", dr["nvCatItemName3"].ToString()); recommendations.Last().lObject.Add("nvCatItemName4", dr["nvCatItemName4"].ToString()); } } res.Error = new ErrorObj(StatusCode.Success); res.Result = recommendations; return(res); } catch (Exception ex) { Log.LogError("GetRecommendationsNewDoctors / TRecommendation_New_SLCT", "iYearId = " + iYearId + ", exception = " + ex); res.Error = new ErrorObj(StatusCode.Error, ex.Message); res.Result = null; return(res); } }
public static User GetUserByUserNameAndPassword(string nvUserName, string nvPassword) { Log.LogInfo("GetUserByUserNameAndPassword, start"); try { SqlParameter guide = new SqlParameter("nvGuide", SqlDbType.NVarChar, 50) { Direction = ParameterDirection.Output }; DataSet ds = SqlDataAccess.ExecuteDatasetSP("TUser_ByUserNameAndPassword_SLCT", new List <SqlParameter>() { new SqlParameter("nvUserName", nvUserName), new SqlParameter("nvPassword", nvPassword), guide }); Log.LogInfo("ds.Tables.Count: " + ds.Tables.Count); if (ds.Tables.Count > 0) { User user = ObjectGenerator <User> .GeneratFromDataRow(ds.Tables[0].Rows[0]); user.nvGuide = ds.Tables[ds.Tables.Count - 1].Rows[0][0].ToString(); //Log.LogInfo("nvGuide: "+ user.nvGuide); return(user); } else { return(null); } } catch (Exception ex) { Log.LogError("GetUserByUserNameAndPassword / TUser_ByUserNameAndPassword_SLCT", "nvUserName = "******", nvPassword = "******", exception = " + ex); return(null); } }
public static int ResetUserPassword(string nvMail) { try { DataSet ds = SqlDataAccess.ExecuteDatasetSP("TUser_Password_SLCT", new SqlParameter("nvMail", nvMail)); if (ds.Tables[0].Rows.Count > 0) { User user = ObjectGenerator <User> .GeneratFromDataRow(ds.Tables[0].Rows[0]); string body = user.nvFirstName + " " + user.nvLastName + "\n" + "שם המשתמש שלך הוא:" + " " + user.nvId + "\n" + "הסיסמה שלך היא:" + " " + user.nvPassword; Messages message = new Messages(); message.nvMessage = body; message.nvSubject = "שיחזור סיסמא"; message.nvTo = user.nvEmail; message.nvFrom = ConfigurationManager.AppSettings["mailFrom"].ToString(); bool b = Messages.SendEmailToOne(message, null, true); if (b == false) { return(2); } //return "שליחת המייל נכשלה"; else { return(1); } // "הסיסמא נשלחה לכתובת מייל שהזנת"; } return(3); // "כתובת המייל לא נמצאה במערכת"; } catch (Exception ex) { Log.ExceptionLog(ex.Message, "ResetUserPassword"); return(2); // "שליחת המייל נכשלה"; } }
public static WhatsAppLink WhatsAppLinkCreate(WhatsAppLink whatsAppLink, int iUserId) { try { List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("iWhatsAppLinkId", whatsAppLink.iWhatsAppLinkId)); parameters.Add(new SqlParameter("nvRedirectLink", whatsAppLink.nvRedirectLink)); parameters.Add(new SqlParameter("nvSource", whatsAppLink.nvSource)); parameters.Add(new SqlParameter("iUserId", iUserId)); DataSet ds = SqlDataAccess.ExecuteDatasetSP("TWhatsAppLink_INS_UPDT", parameters); if (ds.Tables != null && ds.Tables[0].Rows.Count > 0) { whatsAppLink = ObjectGenerator <WhatsAppLink> .GeneratFromDataRow(ds.Tables[0].Rows[0]); } return(whatsAppLink); } catch (Exception x) { Log.LogError("GeTWhatsAppLinks", x.Message); return(null); } }
public static Recommendation GetRecommendationByPhone(string nvPhone) { try { DataRowCollection drc = SqlDataAccess.ExecuteDatasetSP("TRecommendation_ByPhone_SLCT", new SqlParameter("nvPhone", nvPhone)).Tables[0].Rows; if (drc.Count > 0) { return(ObjectGenerator <Recommendation> .GeneratFromDataRow(drc[0])); } else { return(new Recommendation()); } } catch (Exception ex) { Log.LogError("GetRecommendationByPhone / TRecommendation_ByPhone_SLCT", "nvPhone = " + nvPhone + ", exception = " + ex); return(null); } }
public static WhatsAppLink GetWhatsApp(int iLinkId) { try { //Log.LogInfo("GetWhatsApp iLinkId:"+ iLinkId); WhatsAppLink whatsAppLink = new WhatsAppLink(); DataSet ds = SqlDataAccess.ExecuteDatasetSP("TWhatsAppLink_SLCT_ById", new SqlParameter("iLinkId", iLinkId)); if (ds.Tables != null && ds.Tables[0].Rows.Count > 0) { //Log.LogInfo("GetWhatsApp ds.Tables[0].Rows:" + ds.Tables[0].Rows.Count); whatsAppLink = ObjectGenerator <WhatsAppLink> .GeneratFromDataRow(ds.Tables[0].Rows[0]); } //Log.LogInfo("GetWhatsApp iWhatsAppLinkId:" + whatsAppLink.iWhatsAppLinkId); return(whatsAppLink); } catch (Exception x) { Log.LogError("GetWhatsApp", x.Message); return(null); } finally { string soap = OperationContext.Current.RequestContext.RequestMessage.ToString(); IncomingWebRequestContext ctx = WebOperationContext.Current.IncomingRequest; //ctx; //Log.LogInfo("RequestUri: " + ctx.IncomingRequest.UriTemplateMatch.Data); //Log.LogInfo("StatusCode: " + ctx.OutgoingResponse.StatusCode); //Log.LogInfo("Format: " + ctx.OutgoingResponse.Format); //Log.LogInfo("Headers: " + ctx.OutgoingResponse.Headers); //Log.LogInfo("Location: " + ctx.OutgoingResponse.Location); //Message msg = OperationContext.Current.RequestContext.RequestMessage.CreateBufferedCopy(Int32.MaxValue).CreateMessage(); //Log.LogInfo(msg.ToString()); } }
public static List <Year> GetYears() { try { DataTableCollection dtc = SqlDataAccess.ExecuteDatasetSP("TYear_SLCT").Tables; List <CategoryType> lCategoryType = new List <CategoryType>(); foreach (DataRow dr in dtc[1].Rows) { lCategoryType.Add(ObjectGenerator <CategoryType> .GeneratFromDataRow(dr)); } foreach (CategoryType ct in lCategoryType) { CategoryType cat = lCategoryType.Where(c => c.iCatTypeId == ct.iCatTypeParentId).FirstOrDefault(); if (cat != null) { cat.lCategoryType.Add(ct); } } List <Year> years = new List <Year>(); foreach (DataRow dr in dtc[0].Rows) { years.Add(ObjectGenerator <Year> .GeneratFromDataRow(dr)); years.Last().lCategoryType = lCategoryType.Where(c => c.iCatTypeParentId == 0 && c.iYearId == years.Last().iYearId).ToList(); } return(years); } catch (Exception ex) { Log.LogError("GetYears / TYear_SLCT", "exception = " + ex); return(null); } }
public static List <Document> GetDocuments() { { try { List <Document> documents = new List <Document>(); DataRowCollection drc = SqlDataAccess.ExecuteDatasetSP("TDocuments_OfStudents_SLCT").Tables[0].Rows; foreach (DataRow dr in drc) { documents.Add(ObjectGenerator <Document> .GeneratFromDataRow(dr)); documents.Last().lstObject = new Dictionary <string, string>(); documents.Last().lstObject.Add("nvName", dr["nvName"].ToString()); documents.Last().lstObject.Add("nvIdentityCard", dr["nvIdentityCard"].ToString()); documents.Last().lstObject.Add("nvCategory", dr["nvCategory"].ToString()); } return(documents); } catch (Exception ex) { Log.LogError("GetDocuments / TDocuments_OfStudents_SLCT", ", ex " + ex); return(null); } } }
public static Orders OrderInsert(Orders order, int iUserManagerId, int?isFromSite, User customer = null, bool inValidOrder = false) { try { if (order.nvProviderSignature != null) { order.nvProviderSignature = new FileManageCtrl().SaveFile(order.nvProviderSignature.Substring(order.nvProviderSignature.LastIndexOf(",") + 1), "signatures", "png", iUserManagerId, "s1"); } if (order.nvCustomerSignature != null) { order.nvCustomerSignature = new FileManageCtrl().SaveFile(order.nvCustomerSignature.Substring(order.nvCustomerSignature.LastIndexOf(",") + 1), "signatures", "png", iUserManagerId, "s2"); } if (order.nvLocationSignature != null) { order.nvLocationSignature = new FileManageCtrl().SaveFile(order.nvLocationSignature.Substring(order.nvLocationSignature.LastIndexOf(",") + 1), "signatures", "png", iUserManagerId, "s3"); } List <SqlParameter> parameters = ObjectGenerator <Orders> .GetSqlParametersFromObject(order); parameters.Add(new SqlParameter("nvAdressCustomer", customer == null ? null : customer.nvAdress)); parameters.Add(new SqlParameter("nvEmailCustomer", customer == null ? null : customer.nvEmail)); parameters.Add(new SqlParameter("nvMobileNumCustomer", customer == null ? null : customer.nvMobileNum)); parameters.Add(new SqlParameter("statusOrder", inValidOrder)); parameters.Add(new SqlParameter("iUserManagerId", iUserManagerId)); parameters.Add(new SqlParameter("isFromSite", isFromSite)); DataSet ds = SqlDataAccess.ExecuteDatasetSP("TOrder_INS", parameters); order.iOrderId = int.Parse(ds.Tables[0].Rows[0][0].ToString()); if (customer != null && (customer.nvAdress != null || customer.nvEmail != null || customer.nvMobileNum != null)) { User user = new User(); if (ds.Tables.Count > 2) { user = ObjectGenerator <User> .GeneratFromDataRow(ds.Tables[3].Rows[0]); } else { user = ObjectGenerator <User> .GeneratFromDataRow(ds.Tables[1].Rows[0]); } if (customer != null && (user.nvAdress != customer.nvAdress || (user.nvEmail != customer.nvEmail && user.nvEmail != "*****@*****.**") || (user.nvMobileNum != customer.nvMobileNum && user.nvMobileNum != "0543376333"))) { Messages message = new Messages(); message.nvFrom = System.Configuration.ConfigurationManager.AppSettings["mailFrom"]; message.nvTo = System.Configuration.ConfigurationManager.AppSettings["mailFrom"]; message.nvSubject = "עודכנו פרטים עבור הלקוח " + user.nvFirstName + " " + user.nvLastName; message.nvMessage = ""; if (user.nvAdress != customer.nvAdress) { message.nvMessage += "כתובת קודמת: " + user.nvAdress + ", כתובת מעודכנת: " + customer.nvAdress; } if (user.nvEmail != customer.nvEmail && user.nvEmail != "*****@*****.**") { message.nvMessage += "\nמייל קודם: " + user.nvEmail + ", מייל מעודכן: " + customer.nvEmail; } if (user.nvMobileNum != customer.nvMobileNum && user.nvMobileNum != "0543376333") { message.nvMessage += "\nנייד קודם: " + user.nvMobileNum + ", נייד מעודכן: " + customer.nvMobileNum; } Messages.SendEmailToOne(message, null, true); } } return(order); } catch (Exception ex) { Log.ExceptionLog(ex.Message, "OrderInsert"); return(null); } }