//----------------------------------------------- //btnSave_Click //----------------------------------------------- protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } long numID = Convert.ToInt64(Request.QueryString["id"]); SMSNumbersEntity smsUser = SMSNumbersFactory.GetObject(numID); smsUser.Name = txtName.Text; smsUser.Numbers = txtNumber.Text; smsUser.IsActive = cbIsActive.Checked; if (SiteSettings.Sms_HasGroups) { smsUser.GroupID = Convert.ToInt32(ddlSmsGroups.SelectedValue); } //--------------------------------------------------------------------- ExecuteCommandStatus status = SMSNumbersFactory.Update(smsUser); if (status == ExecuteCommandStatus.Done) { Response.Redirect("default.aspx"); } else if (status == ExecuteCommandStatus.AllreadyExists) { lblResult.CssClass = "operation_error"; lblResult.Text = Resources.AdminText.DuplicateItem; } else { lblResult.CssClass = "operation_error"; lblResult.Text = Resources.AdminText.SavingDataFaild; } }
public override async Task <bool> SetCommandStatus(ExecuteCommandStatus status) { bool result = false; if (ConnectionManager != null && status != null) { var wsChannelId = GetActiveChannelName(status.ChannelId, status.NodeId); if (!string.IsNullOrEmpty(wsChannelId)) { MsgLogger.WriteLine($"set (WS) command='{status.CommandName}' status='{status.Status}' for device with nodeid={status.NodeId}"); if (await ConnectionManager.Send(wsChannelId, _userIdentity, status)) { result = true; } else { MsgLogger.WriteError($"{GetType().Name} - SetCommandStatus", $"set (WS) command='{status.CommandName}' status='{status.Status}' for device with nodeid={status.NodeId} failed"); } } } return(result); }
//------------------------------------------ /// <summary> /// Converts the SMSNumbers object properties to SQL paramters and executes the create SMSNumbers procedure /// and updates the SMSNumbers object with the SQL data by reference. /// <example>[Example]bool result=SMSNumbersSqlDataPrvider.Instance.Create(sMSNumbers);.</example> /// </summary> /// <param name="sMSNumbers">The SMSNumbers object.</param> /// <returns>The result of create query.</returns> public ExecuteCommandStatus Create(SMSNumbersEntity sMSNumbers) { using (SqlConnection myConnection = GetSqlConnection()) { SqlCommand myCommand = new SqlCommand("SMSNumbers_Create", myConnection); myCommand.CommandType = CommandType.StoredProcedure; // Set the parameters myCommand.Parameters.Add("@NumID", SqlDbType.BigInt, 8).Direction = ParameterDirection.Output; myCommand.Parameters.Add("@Numbers", SqlDbType.NVarChar, 20).Value = sMSNumbers.Numbers; myCommand.Parameters.Add("@Name", SqlDbType.NVarChar, 200).Value = sMSNumbers.Name; myCommand.Parameters.Add("@GroupID", SqlDbType.Int, 4).Value = sMSNumbers.GroupID; //-------------------------------------------------------------------------------- myCommand.Parameters.Add("@IsActive", SqlDbType.Bit, 1).Value = sMSNumbers.IsActive; //myCommand.Parameters.Add("@JoinDate", SqlDbType.DateTime,8).Value = mailListUsers.JoinDate; myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int, 4).Value = (int)sMSNumbers.ModuleTypeID; myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value = (int)sMSNumbers.LangID; //---------------------------------------------------------------------------------------------- //OwnerID myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid(); //---------------------------------------------------------------------------------------------- // Execute the command myConnection.Open(); ExecuteCommandStatus status = (ExecuteCommandStatus)myCommand.ExecuteScalar(); if (status == ExecuteCommandStatus.Done) { //Get ID value from database and set it in object sMSNumbers.NumID = (long)myCommand.Parameters["@NumID"].Value; } myConnection.Close(); return(status); } }
/// <summary> /// Creates ItemCategories object by calling ItemCategories data provider create method. /// <example>[Example]bool status=ItemCategoriesFactory.Create(itemCategoriesObject);.</example> /// </summary> /// <param name="itemCategoriesObject">The ItemCategories object.</param> /// <returns>Status of create operation.</returns> public static ExecuteCommandStatus Create(ItemCategoriesEntity category, ItemsModulesOptions currentModule) { //Insert user name------------------------------------------ string username = ""; if (HttpContext.Current.User.Identity.IsAuthenticated) { username = HttpContext.Current.User.Identity.Name; category.InsertUserName = username; } //---------------------------------------------------------- ExecuteCommandStatus status = ItemCategoriesSqlDataPrvider.Instance.Create(category, currentModule); //------------------------------------- if (status == ExecuteCommandStatus.Done) { string folder = DCSiteUrls.GetPath_ItemCategoriesDirectory(category.OwnerName, category.ModuleTypeID, category.CategoryID); string folderPhysicalPath = DCServer.MapPath(folder); if (!Directory.Exists(folderPhysicalPath)) { string defaultFolder = DCSiteUrls.GetPath_DefaultCategoryFolder(); string defaultFolderPhysicalPath = DCServer.MapPath(defaultFolder); DirectoryInfo diSource = new DirectoryInfo(defaultFolderPhysicalPath); DirectoryInfo diTarget = new DirectoryInfo(folderPhysicalPath); DcDirectoryManager.CopyAll(diSource, diTarget); } } //------------------------------------- return(status); }
//---------------------------------------------------------- public void AddCategories(ItemsModulesOptions ItemsModule, int ParentID, ModuleBaseTypes ModuleBaseType) { //------------------------------------------------------------- InitialCategory.ParentID = ParentID; InitialCategory.ModuleTypeID = ItemsModule.ModuleTypeID; //------------------------------------------------------------- for (int i = 0; i < 3; i++) { if (SiteSettings.Languages_HasArabicLanguages) { InitialCategory.Details[Languages.Ar] = InitialCategoryArDetails; } if (SiteSettings.Languages_HasEnglishLanguages) { InitialCategory.Details[Languages.En] = InitialCategoryEnDetails; } ExecuteCommandStatus status = ItemCategoriesFactory.Create(InitialCategory, ItemsModule); if (status == ExecuteCommandStatus.Done) { if (ModuleBaseType == ModuleBaseTypes.Items) { AddItems(ItemsModule, InitialCategory.CategoryID); } else if (ModuleBaseType == ModuleBaseTypes.Messages) { AddMessages(ItemsModule.ModuleTypeID, InitialCategory.CategoryID); } } } }
//------------------------------------------ #endregion #region --------------Update-------------- public ExecuteCommandStatus Update(ItemsCommentsEntity comments) { using (SqlConnection myConnection = GetSqlConnection()) { SqlCommand myCommand = new SqlCommand("ItemsComments_Update", myConnection); myCommand.CommandType = CommandType.StoredProcedure; // Set the parameters myCommand.Parameters.Add("@CommentID", SqlDbType.Int, 4).Value = comments.CommentID; //myCommand.Parameters.Add("@ItemID", SqlDbType.Int, 4).Value = comments.ItemID; // myCommand.Parameters.Add("@LangID", SqlDbType.Int).Value = (int)comments.LangID; myCommand.Parameters.Add("@SenderName", SqlDbType.NVarChar, 255).Value = comments.SenderName; //myCommand.Parameters.Add("@CountryID", SqlDbType.Int, 4).Value = comments.CountryID; //myCommand.Parameters.Add("@CtryShort", SqlDbType.Char, 2).Value = comments.CtryShort; //myCommand.Parameters.Add("@SendingDate", SqlDbType.DateTime, 8).Value = comments.SendingDate; myCommand.Parameters.Add("@SenderEmail", SqlDbType.NVarChar, 100).Value = comments.SenderEmail; myCommand.Parameters.Add("@CommentTitle", SqlDbType.NVarChar, 200).Value = comments.CommentTitle; myCommand.Parameters.Add("@CommentText", SqlDbType.NVarChar, 1000).Value = comments.CommentText; myCommand.Parameters.Add("@IsActive", SqlDbType.Bit, 1).Value = comments.IsActive; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@LastUpdateUserName", SqlDbType.NVarChar, 64).Value = (string)comments.LastUpdateUserName; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = comments.OwnerID; //---------------------------------------------------------------------------------- // Execute the command myConnection.Open(); ExecuteCommandStatus status = (ExecuteCommandStatus)myCommand.ExecuteScalar(); myConnection.Close(); return(status); } }
//---------------------------------------------------------- public void AddItems(ItemsModulesOptions itemsModule, int categoryID) { //------------------------------------------------------------- InitialItem.CategoryID = categoryID; InitialItem.ModuleTypeID = itemsModule.ModuleTypeID; //------------------------------------------------------------- for (int i = 0; i < 15; i++) { if (SiteSettings.Languages_HasArabicLanguages) { InitialItem.Details[Languages.Ar] = InitialItemArDetails; } if (SiteSettings.Languages_HasEnglishLanguages) { InitialItem.Details[Languages.En] = InitialItemEnDetails; } ExecuteCommandStatus status = ItemsFactory.Create(InitialItem, itemsModule); if (status == ExecuteCommandStatus.Done) { if (itemsModule.HasComments) { AddComments(itemsModule.ModuleTypeID, InitialItem.ItemID, ModuleBaseTypes.Items); } } } }
//---------------------------------------------------------- //UpdateTestingDataForStaticPages //---------------------------------------------------------- public void UpdateTestingDataForStaticPages() { ItemsModulesOptions SitePagesModule = ItemsModulesOptions.GetType((int)StandardItemsModuleTypes.SitePages); //------------------------------------------------------------- InitialItem.CategoryID = 0; InitialItem.ModuleTypeID = SitePagesModule.ModuleTypeID; //------------------------------------------------------------- foreach (SitePageOptions page in SiteModulesManager.Instance.SitePagesList) { if (page.IsAvailabe) { InitialItem.ItemID = page.PageID; if (SiteSettings.Languages_HasArabicLanguages) { InitialItem.Details[Languages.Ar] = InitialItemArDetails; } if (SiteSettings.Languages_HasEnglishLanguages) { InitialItem.Details[Languages.En] = InitialItemEnDetails; } ExecuteCommandStatus status = ItemsFactory.Update(InitialItem, SitePagesModule); if (status == ExecuteCommandStatus.Done) { if (page.HasComments) { AddComments(SitePagesModule.ModuleTypeID, page.PageID, ModuleBaseTypes.Items); } } } } }
//------------------------------------------ #endregion #region --------------Save-------------- public ExecuteCommandStatus Save(AdvPlacesEntity advPlaces, SPOperation operation) { using (SqlConnection myConnection = GetSqlConnection()) { SqlCommand myCommand = new SqlCommand("AdvPlaces_Save", myConnection); myCommand.CommandType = CommandType.StoredProcedure; // Set the parameters //PlaceID myCommand.Parameters.Add("@SPOperation", SqlDbType.Int, 4).Value = (int)operation; myCommand.Parameters.Add("@PlaceID", SqlDbType.Int, 4).Value = advPlaces.PlaceID; myCommand.Parameters.Add("@PlaceIdentifier", SqlDbType.VarChar, 32).Value = advPlaces.PlaceIdentifier; myCommand.Parameters.Add("@Title", SqlDbType.NVarChar, 64).Value = advPlaces.Title; myCommand.Parameters.Add("@Width", SqlDbType.Int, 4).Value = advPlaces.Width; myCommand.Parameters.Add("@Height", SqlDbType.Int, 4).Value = advPlaces.Height; myCommand.Parameters.Add("@DefaultFilePath", SqlDbType.NVarChar, 128).Value = advPlaces.DefaultFilePath; myCommand.Parameters.Add("@DefaultFileType", SqlDbType.Int, 4).Value = (AdsTypes)advPlaces.DefaultFileType; myCommand.Parameters.Add("@ActiveAdvertiseID", SqlDbType.Int, 4).Value = advPlaces.ActiveAdvertiseID; myCommand.Parameters.Add("@IsRandom", SqlDbType.Bit, 1).Value = advPlaces.IsRandom; myCommand.Parameters.Add("@EnableSeparatedAd", SqlDbType.Bit, 1).Value = advPlaces.EnableSeparatedAd; myCommand.Parameters.Add("@EnableSeparatedCount", SqlDbType.Int, 4).Value = advPlaces.EnableSeparatedCount; myCommand.Parameters.Add("@PlaceType", SqlDbType.Int, 4).Value = (int)advPlaces.PlaceType; // Execute the command myConnection.Open(); ExecuteCommandStatus status = (ExecuteCommandStatus)myCommand.ExecuteScalar(); myConnection.Close(); return(status); } }
//-------------------------------------------------------- #endregion protected void dgComments_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "Activate") { int commentID = Convert.ToInt32(dgComments.DataKeys[e.Item.ItemIndex]); ExecuteCommandStatus status = ItemsCommentsFactory.ActivateComment(commentID); if (status == ExecuteCommandStatus.Done) { LoadData(); } } }
//------------------------------------------ //----------------------------------------------------------------------- public static ExecuteCommandStatus RegisterInSms(int moduleID, string mobile, Languages langID, bool isActive) { SMSNumbersEntity newSmsUser = new SMSNumbersEntity(); newSmsUser.Numbers = mobile; newSmsUser.LangID = langID; newSmsUser.ModuleTypeID = moduleID; newSmsUser.IsActive = isActive; ExecuteCommandStatus status = SMSNumbersFactory.Create(newSmsUser); return(status); }
//------------------------------------------ #endregion #region --------------SaveDetails-------------- public ExecuteCommandStatus SaveDetails(ItemCategoriesEntity itemCategoriesObject, bool AllowDublicateTitlesInCategories, SPOperation operation) { Hashtable categoryDetailsCollection = itemCategoriesObject.Details; ExecuteCommandStatus status = ExecuteCommandStatus.UnknownError; using (SqlConnection myConnection = GetSqlConnection()) { SqlCommand myCommand = new SqlCommand("ItemCategoriesDetails_Save", myConnection); myCommand.CommandType = CommandType.StoredProcedure; // Set the parameters myCommand.Parameters.Add("@SPOperation", SqlDbType.Int, 4).Value = (int)operation; myCommand.Parameters.Add("@CategoryID", SqlDbType.Int, 4); myCommand.Parameters.Add("@LangID", SqlDbType.Int); myCommand.Parameters.Add("@Title", SqlDbType.NVarChar, 128); myCommand.Parameters.Add("@ShortDescription", SqlDbType.NVarChar, 512); myCommand.Parameters.Add("@Description", SqlDbType.NVarChar); //---------------------- myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int, 4); myCommand.Parameters.Add("@ParentID", SqlDbType.Int, 4); myCommand.Parameters.Add("@AllowDublicateTitlesInCategories", SqlDbType.Bit, 1); //-------------------------------------------------------- myCommand.Parameters.Add("@KeyWords", SqlDbType.NVarChar, 256); //-------------------------------------------------------- // Execute the command myConnection.Open(); foreach (DictionaryEntry key in categoryDetailsCollection) { ItemCategoriesDetailsEntity itemDetails = (ItemCategoriesDetailsEntity)key.Value; myCommand.Parameters["@CategoryID"].Value = itemCategoriesObject.CategoryID; myCommand.Parameters["@LangID"].Value = (int)itemDetails.LangID; myCommand.Parameters["@Title"].Value = itemDetails.Title; myCommand.Parameters["@ShortDescription"].Value = itemDetails.ShortDescription; myCommand.Parameters["@Description"].Value = itemDetails.Description; // myCommand.Parameters["@ModuleTypeID"].Value = (int)itemCategoriesObject.ModuleTypeID; myCommand.Parameters["@ParentID"].Value = itemCategoriesObject.ParentID; myCommand.Parameters["@AllowDublicateTitlesInCategories"].Value = AllowDublicateTitlesInCategories; //-------------------------------------------------------- myCommand.Parameters["@KeyWords"].Value = itemDetails.KeyWords; //-------------------------------------------------------- status = (ExecuteCommandStatus)myCommand.ExecuteScalar(); if (status != ExecuteCommandStatus.Done) { break; } } myConnection.Close(); return(status); } }
//----------------------------------------------- #endregion protected void btnSave_Click(object sender, EventArgs e) { if (MoversFW.Components.UrlManager.ChechIsValidIntegerParameter("CommentID")) { if (!Page.IsValid) { return; } ItemsCommentsEntity comments = new ItemsCommentsEntity(); comments.CommentID = Convert.ToInt32(Request.QueryString["CommentID"]); comments.SenderName = txtSenderName.Text; comments.SenderEmail = txtSenderEmail.Text; comments.CommentTitle = txtCommentTitle.Text; comments.CommentText = txtCommentText.Text; comments.IsActive = cbIsActive.Checked; ExecuteCommandStatus status = ItemsCommentsFactory.Update(comments); if (status == ExecuteCommandStatus.Done) { //------------------------------------------------ if (BaseModuleType == ModuleBaseTypes.Items) { Response.Redirect("/AdminCP/Items/" + Identifire + "/Comments/" + pageFile); } else if (BaseModuleType == ModuleBaseTypes.Messages) { Response.Redirect("/AdminCP/Messages/" + Identifire + "/Comments/" + pageFile); } //------------------------------------------------ } else { lblResult.CssClass = "lblResult_Faild"; lblResult.Text = Resources.AdminText.SavingDataFaild; } } else { //------------------------------------------------ if (BaseModuleType == ModuleBaseTypes.Items) { Response.Redirect("/AdminCP/Items/" + Identifire + "/Comments/" + pageFile); } else if (BaseModuleType == ModuleBaseTypes.Messages) { Response.Redirect("/AdminCP/Messages/" + Identifire + "/Comments/" + pageFile); } //------------------------------------------------ } }
//------------------------------------------ #endregion #region --------------ActivateComment-------------- public ExecuteCommandStatus ActivateComment(int commentID) { using (SqlConnection myConnection = GetSqlConnection()) { SqlCommand myCommand = new SqlCommand("ItemsComments_ActivateComment", myConnection); myCommand.CommandType = CommandType.StoredProcedure; // Set the parameters myCommand.Parameters.Add("@CommentID", SqlDbType.Int, 4).Value = commentID; // Execute the command myConnection.Open(); ExecuteCommandStatus status = (ExecuteCommandStatus)myCommand.ExecuteScalar(); myConnection.Close(); return(status); } }
//------------------------------------------ #endregion #region --------------Update-------------- /// <summary> /// Updates ItemCategories object by calling ItemCategories data provider update method. /// <example>[Example]bool status=ItemCategoriesFactory.Update(itemCategoriesObject);.</example> /// </summary> /// <param name="itemCategoriesObject">The ItemCategories object.</param> /// <returns>Status of update operation.</returns> public static ExecuteCommandStatus Update(ItemCategoriesEntity category, ItemsModulesOptions currentModule) { //Update user name------------------------------------------ string username = ""; if (HttpContext.Current.User.Identity.IsAuthenticated) { username = HttpContext.Current.User.Identity.Name; category.LastUpdateUserName = username; } //---------------------------------------------------------- ExecuteCommandStatus status = ItemCategoriesSqlDataPrvider.Instance.Update(category, currentModule); return(status); }
//------------------------------------------ #endregion #region --------------Update-------------- /// <summary> /// Updates SiteDeparments object by calling SiteDeparments data provider update method. /// <example>[Example]bool status=SiteDeparmentsFactory.Update(siteDeparmentsObject);.</example> /// </summary> /// <param name="siteDeparmentsObject">The SiteDeparments object.</param> /// <returns>Status of update operation.</returns> public static ExecuteCommandStatus Update(SiteDeparmentsEntity siteDepartment) { //Update user name------------------------------------------ string username = ""; if (HttpContext.Current.User.Identity.IsAuthenticated) { username = HttpContext.Current.User.Identity.Name; siteDepartment.LastUpdateUserName = username; } //---------------------------------------------------------- ExecuteCommandStatus status = SiteDeparmentsSqlDataPrvider.Instance.Update(siteDepartment); return(status); }
//------------------------------------------ #endregion //----------------------------------------------------------------------- public static ExecuteCommandStatus RegisterInMailList(int moduleID, string email, Languages langID, bool isActive, bool requiredActivationCode) { MailListUsersEntity user = new MailListUsersEntity(); user.ModuleTypeID = moduleID; user.Email = email; user.LangID = langID; user.IsActive = isActive; ExecuteCommandStatus status = MailListUsersFactory.Create(user); if (status == ExecuteCommandStatus.Done && requiredActivationCode && !isActive) { SendActivationCodeMessage(user); } return(status); }
//----------------------------------------------- //btnSave_Click //----------------------------------------------- protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } SMSNumbersEntity smsUser = new SMSNumbersEntity(); smsUser.Name = txtName.Text; smsUser.Numbers = txtNumber.Text; smsUser.IsActive = cbIsActive.Checked; if (SiteSettings.Sms_HasGroups) { smsUser.GroupID = Convert.ToInt32(ddlSmsGroups.SelectedValue); } smsUser.ModuleTypeID = (int)StandardItemsModuleTypes.SMS; //--------------------------------------------------------------------- //Language //--------------------------------------------------------------------- Languages langID = (Languages)SiteSettings.Languages_DefaultLanguageID; if (SiteSettings.Languages_HasMultiLanguages) { langID = (Languages)Convert.ToInt32(ddlLanguages.SelectedValue); } //-------------------------------------- smsUser.LangID = langID; //--------------------------------------------------------------------- ExecuteCommandStatus status = SMSNumbersFactory.Create(smsUser); if (status == ExecuteCommandStatus.Done) { lblResult.CssClass = "operation_done"; lblResult.Text = Resources.AdminText.SavingDataSuccessfuly; ClearControls(); } else if (status == ExecuteCommandStatus.AllreadyExists) { lblResult.CssClass = "operation_error"; lblResult.Text = Resources.AdminText.DuplicateItem; } else { lblResult.CssClass = "operation_error"; lblResult.Text = Resources.AdminText.SavingDataFaild; } }
//-------------------------------------------------------- #endregion #region ---------------btnSave_Click--------------- //----------------------------------------------- //btnSave_Click //----------------------------------------------- protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } int userID = Convert.ToInt32(Request.QueryString["id"]); MailListUsersEntity mailListUser = MailListUsersFactory.GetObject(userID); mailListUser.UserID = userID; mailListUser.Email = txtEmail.Text; mailListUser.IsActive = cbIsActive.Checked; if (SiteSettings.MailList_HasGroups) { //mailListUser.GroupID = Convert.ToInt32(ddlMailListGroups.SelectedValue); string groups = ""; foreach (ListItem item in ddlMailListGroups.Items) { if (item.Selected) { groups += "#" + item.Value + "#"; } } mailListUser.Groups = groups; } ExecuteCommandStatus status = MailListUsersFactory.Update(mailListUser); if (status == ExecuteCommandStatus.Done) { lblResult.Text = Resources.AdminText.SavingDataSuccessfuly; Response.Redirect("default.aspx"); } else if (status == ExecuteCommandStatus.AllreadyExists) { lblResult.CssClass = "lblResult_Faild"; lblResult.Text = Resources.AdminText.DuplicateItem; } else { lblResult.CssClass = "lblResult_Faild"; lblResult.Text = Resources.AdminText.SavingDataFaild; } }
//----------------------------------------------- #endregion protected void ibtnSmsSubscripe_Click(object sender, ImageClickEventArgs e) { //------------------------------------- if (!Page.IsValid) { return; } //------------------------------------- if (txtMobileNo.Text.Trim() == "") { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "a", "alert('" + DynamicResource.GetText("SMS", "EnterNo") + "')", true); return; } SMSNumbersEntity newNumber = new SMSNumbersEntity(); newNumber.Numbers = txtMobileNo.Text; //newNumber.IsActive = true; ExecuteCommandStatus status = SMSNumbersFactory.Create(newNumber); if (status == ExecuteCommandStatus.Done) { lblResult.CssClass = "operation_done"; lblResult.Text = DynamicResource.GetText("SMS", "Done"); try { if ((SmsWebService.WebMethods.SendMessage(ConfigurationManager.AppSettings["SMSKey"], DynamicResource.GetText("SMS", "Welcome"), txtMobileNo.Text)) != SmsWebService.SMSSendStatus.Sent) { //resultMsg += DynamicResource.GetText("SMS","Error"); } } catch { } txtMobileNo.Text = ""; } else if (status == ExecuteCommandStatus.AllreadyExists) { lblResult.CssClass = "operation_error"; lblResult.Text = DynamicResource.GetText("SMS", "ExistBefor"); } else { lblResult.CssClass = "operation_error"; lblResult.Text = DynamicResource.GetText("SMS", "ExistBefor"); } }
//------------------------------------------ #endregion #region --------------Create-------------- /// <summary> /// Converts the SiteDeparments object properties to SQL paramters and executes the create SiteDeparments procedure /// and updates the SiteDeparments object with the SQL data by reference. /// <example>[Example]bool status=SiteDeparmentsSqlDataPrvider.Instance.Create(siteDeparmentsObject);.</example> /// </summary> /// <param name="siteDeparmentsObject">The SiteDeparments object.</param> /// <returns>The status of create query.</returns> public ExecuteCommandStatus Create(SiteDeparmentsEntity siteDeparmentsObject) { using (SqlConnection myConnection = GetSqlConnection()) { SqlCommand myCommand = new SqlCommand("SiteDeparments_Create", myConnection); myCommand.CommandType = CommandType.StoredProcedure; // Set the parameters //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@DepartmentID", SqlDbType.Int, 4).Direction = ParameterDirection.Output; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@PhotoExtension", SqlDbType.VarChar, 5).Value = siteDeparmentsObject.PhotoExtension; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@IsAvailable", SqlDbType.Bit, 1).Value = siteDeparmentsObject.IsAvailable; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int, 4).Value = siteDeparmentsObject.ModuleTypeID; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@ParentID", SqlDbType.Int, 4).Value = (int)siteDeparmentsObject.ParentID; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@RelatedModuleTypeID", SqlDbType.Int, 4).Value = siteDeparmentsObject.RelatedModuleTypeID; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@RelatedPageID", SqlDbType.Int, 4).Value = siteDeparmentsObject.RelatedPageID; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@InsertUserName", SqlDbType.NVarChar, 64).Value = (string)siteDeparmentsObject.InsertUserName; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@TypeID", SqlDbType.Int, 4).Value = siteDeparmentsObject.TypeID; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@Url", SqlDbType.NVarChar, 128).Value = siteDeparmentsObject.Url; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = siteDeparmentsObject.OwnerID; myCommand.Parameters.Add("@OwnerName", SqlDbType.VarChar).Value = siteDeparmentsObject.OwnerName; //---------------------------------------------------------------------------------- // Execute the command myConnection.Open(); ExecuteCommandStatus status = (ExecuteCommandStatus)myCommand.ExecuteScalar(); if (status == ExecuteCommandStatus.Done) { siteDeparmentsObject.DepartmentID = (int)myCommand.Parameters["@DepartmentID"].Value; status = SaveDetails(siteDeparmentsObject, SPOperation.Insert); } myConnection.Close(); return(status); //---------------------------------------------------------------------------------- } }
public static bool IsValid(this ExecuteCommandStatus status) { bool result = false; if (status != null) { if (!string.IsNullOrEmpty(status.CommandId)) { if (!string.IsNullOrEmpty(status.ChannelId)) { if (!string.IsNullOrEmpty(status.CommandName)) { result = true; } } } } return(result); }
protected void btnDeletePhoto_Click(object sender, EventArgs e) { int departmentID = Convert.ToInt32(Request.QueryString["id"]); SiteDeparmentsEntity siteDepartment = SiteDeparmentsFactory.GetObject(departmentID, Languages.Unknowen); if (siteDepartment != null) { if (trParents.Visible) { siteDepartment.ParentID = Convert.ToInt32(ddlParents.SelectedValue); } //Photo----------------------------- if (!string.IsNullOrEmpty(siteDepartment.PhotoExtension)) { //Delete old original photo File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_SiteDeparmentsPhotoOriginals(siteDepartment.OwnerName)) + siteDepartment.Photo); //Delete old Thumbnails File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_SiteDeparmentsPhotoNormalThumbs(siteDepartment.OwnerName)) + SiteDeparmentsFactory.CreateSiteDeparmentsPhotoName(siteDepartment.DepartmentID) + MoversFW.Thumbs.thumbnailExetnsion); File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_SiteDeparmentsPhotoBigThumbs(siteDepartment.OwnerName)) + SiteDeparmentsFactory.CreateSiteDeparmentsPhotoName(siteDepartment.DepartmentID) + MoversFW.Thumbs.thumbnailExetnsion); } //------------------------------------------------ trPhotoPreview.Visible = false; //----------------------------- siteDepartment.PhotoExtension = ""; ExecuteCommandStatus status = SiteDeparmentsFactory.Update(siteDepartment); if (status == ExecuteCommandStatus.Done) { lblResult.CssClass = "lblResult_Done"; lblResult.Text = Resources.AdminText.DeletingOprationDone; } else { lblResult.CssClass = "lblResult_Faild"; lblResult.Text = Resources.AdminText.DeletingOprationFaild; } } }
public override async Task <bool> SetCommandStatus(ExecuteCommandStatus status) { bool result = false; if (ConnectionManager != null && ConnectionManager.IsConnected(CommandExecUuid)) { MsgLogger.WriteLine($"set (WS) command='{status.CommandName}' status='{status.Status}' for device with nodeid={status.NodeId}"); if (await ConnectionManager.Send(CommandExecUuid, UserIdentity, status)) { result = true; } else { MsgLogger.WriteError($"{GetType().Name} - SetCommandStatus", $"set (WS) command='{status.CommandName}' status='{status.Status}' for device with nodeid={status.NodeId} failed"); } } return(result); }
//-------------------------------------------------------- #endregion #region --------------dgComments_DeleteCommand-------------- //--------------------------------------------------------- //dgComments_DeleteCommand //--------------------------------------------------------- protected void dgComments_DeleteCommand(object source, DataGridCommandEventArgs e) { int commentID = Convert.ToInt32(dgComments.DataKeys[e.Item.ItemIndex]); ItemsCommentsEntity comments = ItemsCommentsFactory.GetObject(commentID); ExecuteCommandStatus status = ItemsCommentsFactory.Delete(commentID); if (status == ExecuteCommandStatus.Done) { General.MakeAlertSucess(lblResult, Resources.AdminText.DeletingOprationDone); //if one item in datagrid if (dgComments.Items.Count == 1) { --pager.CurrentPage; } LoadData(); } else { General.MakeAlertError(lblResult, Resources.AdminText.DeletingOprationFaild); } }
//------------------------------------------ #endregion #region --------------Create-------------- /// <summary> /// Converts the Comments object properties to SQL paramters and executes the create Comments procedure /// and updates the Comments object with the SQL data by reference. /// <example>[Example]bool status=ItemsCommentsSqlDataPrvider.Instance.Create(comments);.</example> /// </summary> /// <param name="comments">The Comments object.</param> /// <returns>The status of create query.</returns> public ExecuteCommandStatus Create(ItemsCommentsEntity comments) { using (SqlConnection myConnection = GetSqlConnection()) { SqlCommand myCommand = new SqlCommand("ItemsComments_Create", myConnection); myCommand.CommandType = CommandType.StoredProcedure; // Set the parameters myCommand.Parameters.Add("@CommentID", SqlDbType.Int, 4).Direction = ParameterDirection.Output; myCommand.Parameters.Add("@ItemID", SqlDbType.Int, 4).Value = comments.ItemID; myCommand.Parameters.Add("@LangID", SqlDbType.Int).Value = (int)comments.LangID; myCommand.Parameters.Add("@SenderName", SqlDbType.NVarChar, 255).Value = comments.SenderName; myCommand.Parameters.Add("@CountryID", SqlDbType.Int, 4).Value = comments.CountryID; myCommand.Parameters.Add("@CtryShort", SqlDbType.Char, 2).Value = comments.CtryShort; myCommand.Parameters.Add("@SendingDate", SqlDbType.DateTime, 8).Value = comments.SendingDate; myCommand.Parameters.Add("@SenderEmail", SqlDbType.NVarChar, 100).Value = comments.SenderEmail; myCommand.Parameters.Add("@CommentTitle", SqlDbType.NVarChar, 200).Value = comments.CommentTitle; myCommand.Parameters.Add("@CommentText", SqlDbType.NVarChar, 1000).Value = comments.CommentText; myCommand.Parameters.Add("@IsActive", SqlDbType.Bit, 1).Value = comments.IsActive; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@InsertUserName", SqlDbType.NVarChar, 64).Value = (string)comments.InsertUserName; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int).Value = comments.ModuleTypeID; myCommand.Parameters.Add("@BaseModuleType", SqlDbType.Int).Value = (int)comments.BaseModuleType; //---------------------------------------------------------------------------------- myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = comments.OwnerID; //---------------------------------------------------------------------------------- // Execute the command myConnection.Open(); ExecuteCommandStatus status = (ExecuteCommandStatus)myCommand.ExecuteScalar(); if (status == ExecuteCommandStatus.Done) { //Get ID value from database and set it in object comments.CommentID = (int)myCommand.Parameters["@CommentID"].Value; } myConnection.Close(); return(status); } }
//-------------------------------------------------------- #endregion #region --------------dgComments_DeleteCommand-------------- //--------------------------------------------------------- //dgComments_DeleteCommand //--------------------------------------------------------- protected void dgComments_DeleteCommand(object source, DataGridCommandEventArgs e) { int commentID = Convert.ToInt32(dgComments.DataKeys[e.Item.ItemIndex]); ItemsCommentsEntity comments = ItemsCommentsFactory.GetObject(commentID); ExecuteCommandStatus status = ItemsCommentsFactory.Delete(commentID); if (status == ExecuteCommandStatus.Done) { lblResult.CssClass = "lblResult_Done"; lblResult.Text = Resources.AdminText.DeletingOprationDone; //if one item in datagrid if (dgComments.Items.Count == 1) { --pager.CurrentPage; } LoadData(); } else { lblResult.CssClass = "lblResult_Faild"; lblResult.Text = Resources.AdminText.DeletingOprationFaild; } }
//------------------------------------------ #endregion public ExecuteCommandStatus Update(MailListUsersEntity mailListUsers) { using (SqlConnection myConnection = GetSqlConnection()) { SqlCommand myCommand = new SqlCommand("MailListUsers_Update", myConnection); myCommand.CommandType = CommandType.StoredProcedure; // Set the parameters myCommand.Parameters.Add("@UserID", SqlDbType.Int, 4).Value = mailListUsers.UserID; myCommand.Parameters.Add("@IsActive", SqlDbType.Bit, 1).Value = mailListUsers.IsActive; myCommand.Parameters.Add("@GroupID", SqlDbType.Int, 4).Value = mailListUsers.GroupID; myCommand.Parameters.Add("@Email", SqlDbType.NVarChar, 128).Value = mailListUsers.Email; myCommand.Parameters.Add("@Groups", SqlDbType.NVarChar, 128).Value = mailListUsers.Groups; //---------------------------------------------------------------------------------------------- //OwnerID myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid(); //---------------------------------------------------------------------------------------------- // Execute the command myConnection.Open(); ExecuteCommandStatus status = (ExecuteCommandStatus)myCommand.ExecuteScalar(); myConnection.Close(); return(status); } }
//---------------------------------------------------------- public void AddComments(int ModuleTypeID, int itemID, ModuleBaseTypes ModuleBaseType) { //------------------------------------------------------------- InitialArComment.ItemID = itemID; InitialArComment.BaseModuleType = ModuleBaseType; InitialArComment.ModuleTypeID = ModuleTypeID; //------------------------------------------------------------- InitialEnComment.ItemID = itemID; InitialEnComment.BaseModuleType = ModuleBaseType; InitialEnComment.ModuleTypeID = ModuleTypeID; //------------------------------------------------------------- for (int i = 0; i < 2; i++) { if (SiteSettings.Languages_HasArabicLanguages) { ExecuteCommandStatus ArStatus = ItemsCommentsFactory.Create(InitialArComment); } if (SiteSettings.Languages_HasEnglishLanguages) { ExecuteCommandStatus EnStatus = ItemsCommentsFactory.Create(InitialEnComment); } } }
//---------------------------------------------------------- #endregion public void AddParentCategories(ItemsModulesOptions itemsModule, ModuleBaseTypes ModuleBaseType) { //------------------------------------------------------------- InitialCategoryParent.ParentID = 0; InitialCategoryParent.ModuleTypeID = itemsModule.ModuleTypeID; //------------------------------------------------------------- for (int i = 0; i < 3; i++) { if (SiteSettings.Languages_HasArabicLanguages) { InitialCategoryParent.Details[Languages.Ar] = InitialCategoryArDetails; } if (SiteSettings.Languages_HasEnglishLanguages) { InitialCategoryParent.Details[Languages.En] = InitialCategoryEnDetails; } ExecuteCommandStatus status = ItemCategoriesFactory.Create(InitialCategoryParent, itemsModule); if (status == ExecuteCommandStatus.Done) { AddCategories(itemsModule, InitialCategoryParent.CategoryID, ModuleBaseType); } } }