/// <summary> /// this method is used for deactivating the selected Script(s). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnActivate_Click(object sender, ImageClickEventArgs e) { Int64 returnresult; EScript[] Scripts = GetSelectedScript(); if (Scripts.Length > 0) { StringBuilder strScriptID = new StringBuilder(String.Empty); foreach (EScript oScript in Scripts) { strScriptID.Append("," + oScript.ScriptID.ToString()); } strScriptID.Remove(0, 1); CallCenterDAL callCenterDal = new CallCenterDAL(); returnresult = callCenterDal.SaveScript(strScriptID.ToString(), Convert.ToInt32(EOperationMode.Activate)); errordiv.InnerHtml = (String)GetGlobalResourceObject("Resource", "msgDatabaseResult" + returnresult.ToString()); errordiv.Visible = true; hfScriptID.Value = ""; GetScript(); } }
/// <summary> /// this method is used for adding new and updating the information regarding the script which is /// called on clicking save button. /// </summary> private void UpdateScript() { var script = new EScript(); script.Description = txtDescription.Text; script.Name = txtName.Text; script.Active = true; script.Default = chkIsDefault.Checked; script.ScriptText = Server.HtmlDecode(txtScriptText.Text); var scripttype = new EScriptType(); scripttype.ScriptTypeID = Convert.ToInt32(ddlscripttype.SelectedValue); script.ScriptType = scripttype; Int64 returnresult; var callCenterDal = new CallCenterDAL(); if (hfScriptID.Value.Equals("")) { returnresult = callCenterDal.SaveScript(script, Convert.ToInt32(EOperationMode.Insert)); if (returnresult == 0) { returnresult = 9999990; } } else { script.ScriptID = Convert.ToInt32(((DataTable)(ViewState["DSGRID"])).Rows[grdScript.Rows[Convert.ToInt32(hfScriptID.Value)].DataItemIndex]["ScriptID"]); returnresult = callCenterDal.SaveScript(script, Convert.ToInt32(EOperationMode.Update)); if (returnresult == 0) { returnresult = 9999991; } } errordiv.InnerHtml = (String)GetGlobalResourceObject("Resource", "msgDatabaseResult" + returnresult.ToString()); errordiv.Visible = true; hfScriptID.Value = ""; GetScript(); }