protected void BtnDetail_Click(object sender, EventArgs e) { DataTable dtDetail = DALC.GetDataTable("*", Tools.Tables.V_Calendar, "Id", HiddenDataId.Value, ""); if (dtDetail == null || dtDetail.Rows.Count < 1) { return; } lnkEdit.Visible = false; LblOrgname.Text = dtDetail._Rows("OrgName") + " (" + dtDetail._Rows("OrgShortname") + ")"; LblTitle.Text = dtDetail._Rows("Title"); LblDescription.Text = dtDetail._Rows("Description"); LblStartDate.Text = dtDetail._RowsDatetime("StartDate").ToString("dd.MM.yyyy HH:mm"); LblEndDate.Text = dtDetail._RowsDatetime("EndDate").ToString("dd.MM.yyyy HH:mm"); LblCreatedDate.Text = dtDetail._RowsDatetime("CreatedDate").ToString("dd.MM.yyyy HH:mm"); if (dtDetail._RowsInt("CalendarOganizationsId") == DALCL._Login.calendarOganizationsId) { if (DALCL.CheckPermission(Tools.AdministratorsMenu.Kalendar_idarəetmə)) { lnkEdit.Visible = true; } } PnlModalDialog.Style.Add("padding-top", "10%"); ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "JqueryAlert", "$('#myModal').modal('show');", true); }
private void BindUsers() { DataTable dt = new DataTable(); dt = DALCL.GetUsersById(_usersId); if (dt == null) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } if (dt.Rows.Count < 1) { ConfigL.RedirectURL($"/{Langs.Name}/modules/registration"); return; } dListSocialStatus.SelectedValue = dt._Rows("UsersSocialStatusId"); txtDocumentNumber.Text = dt._Rows("DocumentNumber"); txtName.Text = dt._Rows("Name"); txtSurname.Text = dt._Rows("Surname"); txtPatronymic.Text = dt._Rows("Patronymic"); txtUsername.Text = dt._Rows("Username"); txtBirthDate.Text = dt._RowsDatetime("BirthDate").ToString("dd.MM.yyyy"); dListGender.SelectedValue = dt._Rows("UsersGendersId"); txtAddress.Text = dt._Rows("Address"); txtEmail.Text = dt._Rows("Email"); txtContact.Text = dt._Rows("Contact"); txtDescription.Text = dt._Rows("Description"); dListStatus.SelectedValue = dt._Rows("UsersStatusId"); imgUser.ImageUrl = $"/uploads/users/{dt._Rows("Id")}_{dt._Rows("DocumentNumber")}.jpg"; }
protected void lnkTranslation_Click(object sender, EventArgs e) { //Id-ə görə əgər News table-inda varsa tərcümə üçün insert edek if (!DALCL.CheckNewsById(_newsId)) { ConfigL.MsgBoxAjax("Tərcümə üçün xəbər mövcud deyil"); return; } var dictionaryNewsLangs = new Dictionary <string, object>() { { "NewsId", _newsId }, { "LangsId", Langs.Id }, { "NewsLangsStatusId", (int)Tools.NewsLangsStatus.Hazırlanır }, { "Title", "" }, { "Subtitle", "" }, { "ContentText", "" }, { "VisitorCount", 0 }, { "UpdatedDate", DateTime.Now }, { "CreatedDate", DateTime.Now }, }; int resultId = DALC.InsertDatabase(Tools.Tables.NewsLangs, dictionaryNewsLangs); if (resultId < 1) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } MultiView1.ActiveViewIndex = 0; }
private void BindServicesDetails() { DataTable dt = new DataTable(); dt = DALCL.GetServicesById(_serviceId); if (dt == null) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } if (dt.Rows.Count < 1) { ConfigL.RedirectURL($"/{Langs.Name}/modules/services"); return; } txtTitle.Text = dt._Rows("Title"); txtNameLangs.Text = dt._Rows("Name"); txtDescriptionLangs.Text = dt._Rows("Description"); txtMinMinute.Text = dt._Rows("MinMinute"); txtDailyUse.Text = dt._Rows("DailyUse"); txtUseBetweenHour.Text = dt._Rows("UseBetweenHour"); txtExpireDate.Text = dt._RowsDatetime("ExpireDate").ToString("dd.MM.yyyy"); dListStatus.SelectedValue = dt._RowsBoolean("IsActive") ? "1" : "0"; }
void BindDetailsControls() { DListNewsTypes.DataSource = DALCL.GetNewsTypes(); DListNewsTypes.DataBind(); DListNewsTypes.Items.Insert(0, new ListItem("--", "-1")); DListStatus.DataSource = DALCL.GetNewsLangsStatus(); DListStatus.DataBind(); DListStatus.Items.Insert(0, new ListItem("--", "-1")); }
public static bool ImgResize(string Path, int Width, int Height, System.IO.Stream StreamFileupload, long ImgQuality) { try { //Thumbnain yaradaq, şəkil təmizliyi maksimum olacaq. *************************** string thumbnailFilePath = string.Empty; using (System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(StreamFileupload)) { if (Width == -1) { Width = (bmp.Width * (Height * 100) / bmp.Height) / 100; } else if (Height == -1) { Height = (bmp.Height * (Width * 100) / bmp.Width) / 100; } thumbnailFilePath = HttpContext.Current.Server.MapPath(Path); //Save File System.Drawing.Size newSize = new System.Drawing.Size(Width, Height); // Thumbnail ölçüsü (width = xxx) (height = xxx) using (System.Drawing.Bitmap thumb = new System.Drawing.Bitmap(bmp, newSize)) { using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(thumb)) // Original şəkili grafikə çeviririk: Təmizləmək üçün { //Təmizlik paramterləri: g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; //Şəkil Codec yaradırıq. Sondakı 1 index dəyəridir. System.Drawing.Imaging.ImageCodecInfo codec = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders()[1]; //Encoding paramter maksimum 100L gedir o zaman şəkilin həcmi çox olur. System.Drawing.Imaging.EncoderParameters eParams = new System.Drawing.Imaging.EncoderParameters(1); eParams.Param[0] = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, ImgQuality); //Şəkili yaradırıq və dəyərlərini üstəki kimi daxil edirik. g.DrawImage(bmp, new System.Drawing.Rectangle(0, 0, thumb.Width, thumb.Height)); //Son olaraq Save edirik: thumb.Save(thumbnailFilePath, codec, eParams); return(true); } } } } catch (Exception er) { DALCL.ErrorLog(string.Format("ImgResize catch error: {0}, path: {1}", er.Message, Path)); return(false); } }
private void BindReports() { lblUsersFullname.Text = DALCL.GetUsersById(_usersId)._Rows("Fullname"); grdReports.DataSource = DALC.GetDataTableBySqlCommand ( "GetServicesUsedByUsersId", "OrganizationsId,LangsId,UsersId", new object[] { DALCL._Login.organizationsId, (int)Tools.Langs.AZ, _usersId }, CommandType.StoredProcedure ); grdReports.DataBind(); }
private void BindDList() { //dListOrganizations.DataSource = DALCL.GetAllOrganizations(); //dListOrganizations.DataBind(); //dListOrganizations.Items.Insert(0, new ListItem("--", "-1")); dListOrganizations.Items.Add(new ListItem(DALCL._Login.organizationsName, DALCL._Login.organizationsId.ToString())); dListOrganizations.Enabled = false; dListAdministratorsStatus.DataSource = DALCL.GetAdministratorsStatus(); dListAdministratorsStatus.DataBind(); dListAdministratorsStatus.Items.Insert(0, new ListItem("--", "-1")); }
void BindNewsDetails(int newsId) { BindDetailsControls(); DataTable dt = DALCL.GetNewsByID(newsId); if (dt == null) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } if (dt.Rows.Count < 1) { MultiView1.ActiveViewIndex = 1; return; } DataTable dtLangs = DALCL.GetAllLangs(); if (dtLangs == null) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } string langs = dt._Rows("Langs"); for (int i = 0; i < dtLangs.Rows.Count; i++) { ltrLangs.Text += $"<a href=\"/{dtLangs._Rows("Name", i)}/modules/news/operations/edit/{ConfigL._Route("id")}\">" + $"<img src=\"/images/langs/{(("," + langs + ",").IndexOf("," + dtLangs._Rows("Id", i) + ",") > -1 ? $"{dtLangs._Rows("Name", i)}-lang" : $"{dtLangs._Rows("Name", i)}-lang-d")}.png\"/></a>"; } DListNewsTypes.SelectedValue = dt._Rows("NewsTypesId"); TxtTitle.Text = dt._Rows("Title"); TxtTitleSub.Text = dt._Rows("SubTitle"); LblSimvolCount.Text = "- simvol sayı : 300 / " + TxtTitleSub.Text.Length._ToString(); TxtShowDate.Text = dt._RowsDatetime("ShowDate").ToString("dd.MM.yyyy HH:mm"); txtContent.Text = dt._Rows("ContentText"); ImgMedium.ImageUrl = $"{dt._Rows("Path")}?{((DateTime)dt._RowsObject("UpdatedDate")).Ticks.ToString()}"; DListStatus.SelectedValue = dt._Rows("NewsLangsStatusId"); //Update-də istifadə olunur BtnSave.CommandArgument = dt._Rows("NewsLangsId"); BindImgDetails(); }
protected void Page_Load(object sender, EventArgs e) { //Router ilə gəlmədikdə main ataq. if (string.IsNullOrEmpty(Langs.Name)) { ConfigL.RedirectURL("/az/modules"); return; } pnlMain.Style.Clear(); if (!IsPostBack) { ltrOperatorName.Text = DALCL._Login.fullname; DataTable Dt = DALCL.GetAdministratorsMenu(0); DataTable DtSub = new DataTable(); RptLangs.DataSource = DALCL.GetAllLangs(); RptLangs.DataBind(); foreach (DataRow Dr in Dt.Rows) { DtSub = DALCL.GetAdministratorsMenu(Dr["ID"]._ToInt16()); if (DtSub.Rows.Count < 1) { LtrLeftMenu.Text += string.Format( @"<li onclick=""location.href='/{0}/modules/{1}'; return false;""> <a href=""/{0}/modules/{1}""> <img src=""/images/leftmenu/{2}.png""/>{3} </a> </li>", Langs.Name, Dr["PageName"], Dr["ID"], Dr["Name"]); } else { LtrLeftMenu.Text += string.Format(@"<li class=""has-dropdown""> <img src=""/images/leftmenu/{0}.png""/>{1} </li>", Dr["ID"], Dr["Name"]); LtrLeftMenu.Text += @"<ul class=""dropdown"">"; foreach (DataRow DrSub in DtSub.Rows) { LtrLeftMenu.Text += string.Format(@"<li><a href=""/{0}/modules/{1}"">{2}</a></li>", Langs.Name, DrSub["PageName"], DrSub["Name"]); } LtrLeftMenu.Text += "</ul>"; } } } }
private void BindList() { dListSocialStatus.DataSource = DALCL.GetUsersSocialStatusActive(); dListSocialStatus.DataBind(); dListSocialStatus.Items.Insert(0, new ListItem("--", "-1")); dListGender.DataSource = DALCL.GetUsersGenders(); dListGender.DataBind(); dListGender.Items.Insert(0, new ListItem("--", "-1")); dListStatus.DataSource = DALCL.GetUsersStatus(); dListStatus.DataBind(); dListStatus.Items.Insert(0, new ListItem("--", "-1")); }
protected void Page_PreInit(object sender, EventArgs e) { if (DALCL._Login == null) { ConfigL.RedirectLogin(); return; } if (!DALCL.CheckPermission(Tools.AdministratorsMenu.Tədbirlər)) { ConfigL.RedirectError(); return; } }
protected void LnkImgDeleted_Command(object sender, CommandEventArgs e) { try { LinkButton lnk = sender as LinkButton; new System.IO.FileInfo(Server.MapPath(e.CommandArgument._ToString())).Delete(); new System.IO.FileInfo(Server.MapPath(e.CommandArgument._ToString().Replace("othersmall", "other"))).Delete(); DALCL.DeleteFiles(Tools.Tables.NewsFiles, int.Parse(e.CommandName)); BindImgDetails(); } catch { ConfigL.MsgBoxAjax("Şəkil silinə bilmədi."); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtLogin.Text)) { ConfigL.MsgBoxAjax("İstifadəçi adınızı daxil edin!"); return; } if (string.IsNullOrEmpty(txtPassword.Text)) { ConfigL.MsgBoxAjax("İstifadəçi şifrənizi daxil edin!"); return; } DataTable dtLoginControl = DALC.GetDataTable("*", Tools.Tables.V_Administrators, "Username,Password,AdministratorsStatusId", new object[] { txtLogin.Text, txtPassword.Text.SHA1Special(), (int)Tools.AdministratorsStatus.Aktiv }); if (dtLoginControl == null) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } if (dtLoginControl.Rows.Count < 1) { ConfigL.MsgBoxAjax("Giriş baş tutmadı!"); return; } DALCL.Login loginInfo = new DALCL.Login(); loginInfo.organizationsId = dtLoginControl._RowsInt("OrganizationsId"); loginInfo.organizationsName = dtLoginControl._Rows("OrganizationsName"); loginInfo.calendarOganizationsId = dtLoginControl._RowsInt("CalendarOganizationsId"); loginInfo.administratorsId = dtLoginControl._RowsInt("ID"); loginInfo.fullname = dtLoginControl._Rows("Fullname"); loginInfo.permissions = dtLoginControl._Rows("AdministratorsMenuList"); Session["Login"] = loginInfo; if (DALCL.CheckPermission(Tools.AdministratorsMenu.Kalendar)) { ConfigL.RedirectURL("/az/modules/calendar"); } else { ConfigL.RedirectURL("/az/modules/"); } }
private void BindDList() { dListStatus.DataSource = DALCL.GetSurveysStatus(); dListStatus.DataBind(); dListStatus.Items.Insert(0, new ListItem("--", "-1")); //string list = DALCL.GetSurveysSubscriptions(_surveysId) + ","; //hdnSubscriptionsList.Value = list; //for (int i = 0; i < grdSurveysSubscriptions.Rows.Count; i++) //{ // if (list.IndexOf($",{grdSurveysSubscriptions.DataKeys[i]["Id"]._ToString()},") > -1) // { // ((CheckBox)grdSurveysSubscriptions.Rows[i].Cells[1].Controls[1]).Checked = true; // } //} }
protected void Page_Load(object sender, EventArgs e) { if (DALCL._Login == null) { ConfigL.RedirectLogin(); return; } if (!DALCL.CheckPermission(Tools.AdministratorsMenu.Təşkilatlar)) { ConfigL.RedirectError(); return; } if (DALCL._Login.calendarOganizationsId < 1) { MultiView1.ActiveViewIndex = 1; return; } _calendarId = ConfigL._Route("id", "-1")._ToInt32(); _operationsType = ConfigL._Route("type", "add"); if (!IsPostBack) { if (ConfigL._GetQueryString("selectedDate").Length > 0) { txtStartDate.Text = ConfigL._GetQueryString("selectedDate") + " 09:00"; } ((Literal)Master.FindControl("LtrTitle")).Text = "KALENDAR İDARƏETMƏ"; BindList(); if (_operationsType != "add") { BindCalendar(); } else { dListStatus.SelectedValue = "1"; dListStatus.Enabled = false; } } }
protected void lnlkEdit_Click(object sender, EventArgs e) { btnSave.Text = "DÜZƏLT"; btnSave.CommandArgument = (sender as LinkButton).CommandArgument; DataTable dtDetail = DALCL.GetCalendarOrganizationsById(int.Parse(btnSave.CommandArgument)); if (dtDetail == null || dtDetail.Rows.Count < 1) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } txtName.Text = dtDetail._Rows("Name"); txtShortName.Text = dtDetail._Rows("Shortname"); dListStatus.SelectedValue = dtDetail._RowsBoolean("IsActive") ? "1" : "0"; DlistPublic.SelectedValue = dtDetail._RowsBoolean("IsPublic") ? "1" : "0"; }
protected void BtnAddFile_Click(object sender, EventArgs e) { string fileName = ""; string ImgHtml = ""; string FileType = ""; DateTime Date = DateTime.Now; string path = "/uploads/contents/"; HttpFileCollection Files = Request.Files; for (int i = 0; i < Files.Count - 2; i++) { if (Files[i].ContentLength > 0) { FileType = System.IO.Path.GetExtension(Files[i].FileName).Trim('.'); if (_allowTypes.IndexOf("-" + FileType.ToLower() + "-") > -1) { if (!Files[i].CheckFileContentLength(50)) { continue; } fileName = DateTime.Now.ToString("ddMMyyyyHHmmssfff") + "_" + i.ToString(); path = $"{path}{fileName}.{FileType}"; ImgHtml += "<img src=\"" + path + "\" alt=\"news-detail\"/><br/><br/>"; System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(Files[i].InputStream); ImageResize.ImgResize(path, bmp.Width, bmp.Height, Files[i].InputStream, 95L); DALCL.InsertFileUpload( (int)Tools.FilesFolders.Xəbərlər, (int)(Tools.FilesTypes)Enum.Parse(typeof(Tools.FilesTypes), FileType), path, fileName, Files[i].ContentLength); } } } txtContent.Text += ImgHtml; }
private void BindList() { dListOrganizations.DataSource = DALCL.GetActiveOrganizations(); dListOrganizations.DataBind(); dListOrganizations.Items.Insert(0, new ListItem("--", "-1")); dlistCalendar.DataSource = DALC.GetDataTableBySqlCommand("Select Id,Name from CalendarOganizations Where IsActive=1 and OrganizationsId=@OrganizationsId Order by Name asc", "OrganizationsId", new object[] { DALCL._Login.organizationsId }); dlistCalendar.DataBind(); dlistCalendar.Items.Insert(0, new ListItem("--", "-1")); dListOrganizations.SelectedValue = DALCL._Login.administratorsId.ToString(); dListOrganizations.Enabled = false; dListAdministratorsStatusId.DataSource = DALCL.GetAdministratorsStatus(); dListAdministratorsStatusId.DataBind(); dListAdministratorsStatusId.Items.Insert(0, new ListItem("--", "-1")); grdAdministratorsMenu.DataSource = DALCL.GetAdministratorsMenu(0); grdAdministratorsMenu.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (DALCL._Login == null) { ConfigL.RedirectLogin(); return; } if (!DALCL.CheckPermission(Tools.AdministratorsMenu.Təşkilatlar)) { ConfigL.RedirectError(); return; } if (!IsPostBack) { ((Literal)Master.FindControl("LtrTitle")).Text = "TƏŞKİLATLAR"; BindCalendar(); } }
protected void Page_Load(object sender, EventArgs e) { if (DALCL._Login == null) { ConfigL.RedirectLogin(); return; } if (!DALCL.CheckPermission(Tools.AdministratorsMenu.Kalendar)) { ConfigL.RedirectError(); return; } ((Literal)Master.FindControl("LtrTitle")).Text = "KALENDAR"; if (!IsPostBack) { DlistOrganizations.DataSource = DALC.GetDataTable("Id,Name", Tools.Tables.CalendarOganizations, "Where IsActive=1 Order by Name asc"); DlistOrganizations.DataBind(); DlistOrganizations.Items.Insert(0, new ListItem("--", "0")); DlistTypes.DataSource = DALC.GetDataTable("Id,Name", Tools.Tables.CalendarTypes, "Where IsActive=1 Order by Priority asc"); DlistTypes.DataBind(); DlistTypes.Items.Insert(0, new ListItem("--", "0")); for (int i = 0; i < MonthList.Length; i++) { DlistMonth.Items.Add(new ListItem(MonthList[i], (i + 1).ToString())); } for (int i = 2015; i < DateTime.Now.Year + 5; i++) { DlistYear.Items.Add(i.ToString()); } LnkToday.Text = $"Bugün ({DateTime.Now.ToString("dd.MM.yyyy")})"; ICalendarDataBind(DateTime.Now.Month, DateTime.Now.Year); } }
private void BindAdministrators() { DataTable dt = DALCL.GetAdministratorsById(_administratorsId); if (dt == null) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } if (dt.Rows.Count < 1) { ConfigL.RedirectURL($"/{Langs.Name}/modules/registration"); return; } dlistCalendar.SelectedValue = dt._Rows("CalendarOganizationsId"); dListOrganizations.SelectedValue = dt._Rows("OrganizationsId"); txtUsername.Text = dt._Rows("Username"); txtFullName.Text = dt._Rows("Fullname"); txtPosition.Text = dt._Rows("Position"); txtPhone.Text = dt._Rows("Phone"); txtEmail.Text = dt._Rows("Email"); dListAdministratorsStatusId.SelectedValue = dt._Rows("AdministratorsStatusId"); string list = $",{dt._Rows("AdministratorsMenuList")},"; for (int i = 0; i < grdAdministratorsMenu.Rows.Count; i++) { ((CheckBox)grdAdministratorsMenu.Rows[i].Cells[1].Controls[1]).Checked = (list == ",*," || (list.IndexOf($",{grdAdministratorsMenu.DataKeys[i]["Id"]._ToString()},") > -1)); } imgUser.ImageUrl = $"/uploads/administrators/{dt._Rows("Id")}.jpg"; //Özü olanda permissionlarını dəyişə bilməsin. if (_administratorsId == DALCL._Login.administratorsId) { grdAdministratorsMenu.Enabled = false; } }
private void BindSurveysDetails() { DataTable dt = new DataTable(); dt = DALCL.GetSurveysById(_surveysId); if (dt == null) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } if (dt.Rows.Count < 1) { ConfigL.RedirectURL($"/{Langs.Name}/modules/registration"); return; } txtTitle.Text = dt._Rows("Title"); txtQuestions.Text = dt._Rows("Question"); dListStatus.SelectedValue = dt._Rows("SurveysStatusId"); }
private void BindServicesDetails() { DataTable dt = new DataTable(); dt = DALCL.GetServicesById(_serviceId); if (dt == null) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } if (dt.Rows.Count < 1) { ConfigL.RedirectURL($"/{Langs.Name}/modules/conferences"); return; } txtTitle.Text = dt._Rows("Title"); txtNameLangs.Text = dt._Rows("Name"); txtDescriptionLangs.Text = dt._Rows("Description"); dListStatus.SelectedValue = dt._RowsBoolean("IsActive") ? "1" : "0"; }
private void BindCalendar() { DataTable dt = DALCL.GetCalendarById(_calendarId); if (dt == null || dt.Rows.Count < 1) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } if (DALCL._Login.calendarOganizationsId != dt._RowsInt("CalendarOganizationsId")) { Response.Redirect("/az/modules/calendar"); return; } dListCalendarTypes.SelectedValue = dt._Rows("CalendarTypesId"); txtTitle.Text = dt._Rows("Title"); txtDescription.Text = dt._Rows("Description"); txtStartDate.Text = dt._RowsDatetime("StartDate").ToString("dd.MM.yyyy HH:mm"); txtEndDate.Text = dt._RowsDatetime("EndDate").ToString("dd.MM.yyyy HH:mm"); dListStatus.SelectedValue = dt._RowsBoolean("IsActive") ? "1" : "0"; }
private void BindGrdServicesVotesTypesRelations() { grdServicesVotesTypes.DataSource = DALCL.GetServicesVotesTypesRelations(_serviceId); grdServicesVotesTypes.DataBind(); }
private void BindDList() { dListSocialStatus.DataSource = DALCL.GetUsersSocialStatusAll(); dListSocialStatus.DataBind(); dListSocialStatus.Items.Insert(0, new ListItem("--", "-1")); }
private void BindGrdSurveysSubscriptions() { grdSurveysSubscriptions.DataSource = DALCL.GetSurveysSubscriptions(_surveysId); grdSurveysSubscriptions.DataBind(); }
protected void btnSaveAnswers_Click(object sender, EventArgs e) { ConfigL.ClearBorderColor(pnlAnswers); if (string.IsNullOrEmpty(txtAnswer.Text)) { ConfigL.BorderColor(txtAnswer); return; } if (DALCL.CheckSurveysAnswers(_surveysId, txtAnswer.Text)) { ConfigL.BorderColor(txtAnswer); ConfigL.MsgBoxAjax("Bu cavab istifadə olunur!"); return; } var dictionaryAnswers = new Dictionary <string, object>() { { "Title", txtAnswer.Text }, }; int surveysAnswersId; int result; DALC.Transaction transaction = new DALC.Transaction(); if (btnSaveAnswers.CommandArgument == "0") { dictionaryAnswers.Add("SurveysId", _surveysId); dictionaryAnswers.Add("VotesCount", 0); dictionaryAnswers.Add("IsActive", true); result = DALC.InsertDatabase(Tools.Tables.SurveysAnswers, dictionaryAnswers, transaction); if (result < 1) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } surveysAnswersId = result; DataTable dtAnswersLangs = new DataTable(); dtAnswersLangs.Columns.Add("SurveysAnswersId", typeof(int)); dtAnswersLangs.Columns.Add("LangsId", typeof(int)); dtAnswersLangs.Columns.Add("Answer", typeof(string)); dtAnswersLangs.Columns.Add("CreatedDate", typeof(DateTime)); DataRow dr; foreach (Tools.Langs langs in (Tools.Langs[])Enum.GetValues(typeof(Tools.Langs))) { dr = dtAnswersLangs.NewRow(); dr["SurveysAnswersId"] = surveysAnswersId; dr["LangsId"] = (int)langs; dr["Answer"] = txtAnswer.Text; dr["CreatedDate"] = DateTime.Now; dtAnswersLangs.Rows.Add(dr); } result = DALC.InsertBulk(Tools.Tables.SurveysAnswersLangs, dtAnswersLangs, transaction, true); if (result < 1) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } } else { surveysAnswersId = int.Parse(btnSaveAnswers.CommandArgument); dictionaryAnswers.Add("WhereId", surveysAnswersId); result = DALC.UpdateDatabase(Tools.Tables.SurveysAnswers, dictionaryAnswers, transaction); if (result < 1) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } var dictionaryAnswersLangs = new Dictionary <string, object>() { { "Answer", txtAnswer.Text }, { "CreatedDate", DateTime.Now }, { "WhereSurveysAnswersId", surveysAnswersId }, { "WhereLangsId", Langs.Id }, }; result = DALC.UpdateDatabase(Tools.Tables.SurveysAnswersLangs, dictionaryAnswersLangs, transaction, true); if (result < 1) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } } txtAnswer.Text = ""; btnSaveAnswers.CommandArgument = "0"; BindSurveysAnswers(); }
protected void btnSave_Click(object sender, EventArgs e) { ConfigL.ClearBorderColor(pnlControls); if (string.IsNullOrEmpty(txtTitle.Text)) { ConfigL.BorderColor(txtTitle); return; } if (string.IsNullOrEmpty(txtQuestions.Text)) { ConfigL.BorderColor(txtQuestions); return; } if (dListStatus.SelectedValue == "-1") { ConfigL.BorderColor(dListStatus); return; } if (DALCL.CheckSurveysQuestion(_surveysId, txtQuestions.Text)) { ConfigL.BorderColor(txtQuestions); ConfigL.MsgBoxAjax("Bu sual istifadə olunur!"); return; } DALC.Transaction transaction = new DALC.Transaction(); int check; var dictionarySurveys = new Dictionary <string, object>() { { "SurveysStatusId", int.Parse(dListStatus.SelectedValue) } }; DataTable dtSurveysLangs = new DataTable(); dtSurveysLangs.Columns.Add("SurveysId", typeof(int)); dtSurveysLangs.Columns.Add("LangsId", typeof(int)); dtSurveysLangs.Columns.Add("Question", typeof(string)); dtSurveysLangs.Columns.Add("CreatedDate", typeof(DateTime)); dtSurveysLangs.Columns.Add("UpdatedDate", typeof(DateTime)); if (_operationsType == "add") { dictionarySurveys.Add("OrganizationsId", DALCL._Login.organizationsId); dictionarySurveys.Add("Title", txtTitle.Text); dictionarySurveys.Add("VotesCount", 0); int resultId = DALC.InsertDatabase(Tools.Tables.Surveys, dictionarySurveys, transaction); if (resultId < 1) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } _surveysId = resultId; Dictionary <string, object> dictionarySurveysSubscriptions = new Dictionary <string, object>(); dictionarySurveysSubscriptions.Add("SurveysId", _surveysId); dictionarySurveysSubscriptions.Add("OrganizationsId", DALCL._Login.organizationsId); dictionarySurveysSubscriptions.Add("CreatedDate", DateTime.Now); dictionarySurveysSubscriptions.Add("IsActive", true); resultId = DALC.InsertDatabase(Tools.Tables.SurveysSubscriptions, dictionarySurveysSubscriptions); if (resultId < 1) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } DataRow dr; foreach (Tools.Langs langs in (Tools.Langs[])Enum.GetValues(typeof(Tools.Langs))) { dr = dtSurveysLangs.NewRow(); dr["SurveysId"] = _surveysId; dr["LangsId"] = (int)langs; dr["Question"] = txtQuestions.Text; dr["CreatedDate"] = DateTime.Now; dr["UpdatedDate"] = DateTime.Now; dtSurveysLangs.Rows.Add(dr); } resultId = DALC.InsertBulk(Tools.Tables.SurveysLangs, dtSurveysLangs, transaction, true); if (resultId < 1) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } ConfigL.MsgBoxAjax(Config._AlertMessages.Success, $"/{Langs.Name}/modules/surveys/operations/edit/{_surveysId}"); } else if (_operationsType == "edit") { dictionarySurveys.Add("WhereId", _surveysId); check = DALC.UpdateDatabase(Tools.Tables.Surveys, dictionarySurveys, transaction); if (check < 1) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } var dictionarySurveysLangs = new Dictionary <string, object>() { { "Question", txtQuestions.Text }, { "UpdatedDate", DateTime.Now }, { "WhereSurveysId", _surveysId }, { "WhereLangsId", Langs.Id }, }; check = DALC.UpdateDatabase(Tools.Tables.SurveysLangs, dictionarySurveysLangs, transaction, true); if (check < 1) { ConfigL.MsgBoxAjax(Config._AlertMessages.Error); return; } } ConfigL.MsgBoxAjax(Config._AlertMessages.Success); }