protected void SaveControl(object source, CommandEventArgs e) { string moduleName = Constants.ModuleName; string componentName = Constants.ComponentName; //Get the index of the row to save int index = gdFormSetting.EditItemIndex; FormRightInfo editItem = FormControls[index]; HiddenField hidControlID = (HiddenField)gdFormSetting.Items[index].FindControl("hidControlID"); TextBox txtControlID = (TextBox)gdFormSetting.Items[index].FindControl("txtControlID"); DropDownList ddlEnable = (DropDownList)gdFormSetting.Items[index].FindControl("ddlEnable"); DropDownList ddlRequire = (DropDownList)gdFormSetting.Items[index].FindControl("ddlRequire"); TextBox txtClientScript = (TextBox)gdFormSetting.Items[index].FindControl("txtClientScript"); //TextBox txtVote = (TextBox)gdFormSetting.Items[index].FindControl("txtVote"); TextBox txtErrorMessageResourceID = (TextBox)gdFormSetting.Items[index].FindControl("txtErrorMessageResourceID"); if (!String.IsNullOrEmpty(txtControlID.Text)) { editItem.ControlID = txtControlID.Text; editItem.Enable = Convert.ToBoolean(ddlEnable.SelectedValue); editItem.Require = Convert.ToBoolean(ddlRequire.SelectedValue); editItem.ClientScript = txtClientScript.Text; //editItem.addVote(txtVote.Text); editItem.ErrorMessageResourceID = txtErrorMessageResourceID.Text; FormRightController formRightCtrl = new FormRightController(moduleName, componentName, DataProvider.GetConnectionString()); formRightCtrl.UpdateFormRight(editItem, hidControlID.Value); } else { } if (AddMode) { FormRightController formRightCtrl = new FormRightController(moduleName, componentName, DataProvider.GetConnectionString()); List<string> proIDList = new List<string>(); for (int i = 0; i < ddlProID.Items.Count; i++) { proIDList.Add(ddlProID.Items[i].Text); } formRightCtrl.InsertFormRight(editItem, UserInfo.UserID, proIDList); //Remove the temporary added row FormControls = GetControls(InitProcessID); AddMode = false; } //Reset Edit Index gdFormSetting.EditItemIndex = -1; BindControls(); }
private FormRightCollection GetControls(string processID) { string moduleName = Constants.ModuleName; string componentName = Constants.ComponentName; FormRightController formRigthCtrl = new FormRightController(moduleName, componentName, DataProvider.GetConnectionString()); List<FormRightInfo> lstFormRightInfo = formRigthCtrl.GetFormRightSetting(processID); FormRightCollection col = new FormRightCollection(); for (int i = 0; i < lstFormRightInfo.Count; i++) { col.Add(lstFormRightInfo[i]); } return col; }
private void DeleteControl(object source, DataGridCommandEventArgs e) { string moduleName = Constants.ModuleName; string componentName = Constants.ComponentName; //Get the index of the row to delete int index = e.Item.ItemIndex; //Remove the rule from the rules collection FormControls.RemoveAt(index); Label lblControlID = (Label)gdFormSetting.Items[index].FindControl("lblControlID"); //Save the new collection FormRightController formRightCtrl = new FormRightController(moduleName, componentName, DataProvider.GetConnectionString()); formRightCtrl.DeleteFormRight(lblControlID.Text); //Rebind the collection BindControls(); }
protected void SetFormValidation(string processID) { string moduleName = Constants.ModuleName; string componentName = Constants.ComponentName; FormRightController _formRigthCtrl = new FormRightController(moduleName, componentName, DataProvider.GetConnectionString()); List<FormRightInfo> lstFormRightInfo = _formRigthCtrl.GetFormRightSetting(processID); for (int i = 0; i < lstFormRightInfo.Count; i++) { FormRightInfo formRightInfo = lstFormRightInfo[i]; formRightInfo.ErrorMessage = Localization.GetString(formRightInfo.ErrorMessageResourceID, LocalResourceFile); } string js = _formRigthCtrl.MakeFormValidationScript(lstFormRightInfo); ScriptManager.RegisterClientScriptBlock(this.Page, Type.GetType("System.String"), moduleName + "_" + componentName + "_FormValidation", js, true); }