public bool CreateDelegation(DelegationInfo info) { try { string sql = "SProc_AddDelegation"; SqlParameter[] paras = { new SqlParameter("@ProcName", info.ProcName) , new SqlParameter("@ActivityName", info.ActivityName) , new SqlParameter("@Conditions", info.Conditions) , new SqlParameter("@FromUser", info.FromUser) , new SqlParameter("@ToUser", info.ToUser) , new SqlParameter("@StartDate", info.StartDate) , new SqlParameter("@EndDate", info.EndDate) , new SqlParameter("@CreateDate", info.CreateDate) , new SqlParameter("@CreatedByUser", DBManager.GetCurrentUserAD()) , new SqlParameter("@Remark", info.Remark) , new SqlParameter("@State", info.State) }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, sql, paras); return(true); } catch (Exception ex) { DBManager.RecoreErrorProfile(ex, "DelegationDAL.CreateDelegation", DBManager.GetCurrentUserAD()); return(false); } }
public void DelegationEncoding() { var delegInfo = new DelegationInfo() { }; var encoded = delegInfo.Encode(); Assert.IsNotNull(encoded); }
public void DelegationEncoding_Roundtrip() { var delegInfo = new DelegationInfo() { DelegationTicket = new KrbCred { Tickets = new[] { new KrbTicket { EncryptedPart = new KrbEncryptedData { Cipher = new byte[16], EType = EncryptionType.AES128_CTS_HMAC_SHA1_96 }, Realm = "blah.test.com", SName = KrbPrincipalName.FromString("*****@*****.**"), TicketNumber = 245 } }, EncryptedPart = new KrbEncryptedData { Cipher = new byte[16], EType = EncryptionType.AES128_CTS_HMAC_SHA1_96 } } }; var encoded = delegInfo.Encode(); Assert.IsNotNull(encoded); var decoded = new DelegationInfo().Decode(encoded); Assert.IsNotNull(decoded); Assert.IsNotNull(decoded.DelegationTicket); Assert.IsNotNull(decoded.DelegationTicket.Tickets); Assert.AreEqual(1, decoded.DelegationTicket.Tickets.Length); Assert.IsNotNull(decoded.DelegationTicket.EncryptedPart); }
protected void btnOK_Click(object sender, EventArgs e) { DelegationBLL bll = new DelegationBLL(); DelegationInfo info = new DelegationInfo(); info.ProcName = ddlProcess.SelectedValue; info.ActivityName = ""; info.Conditions = rbtnNew.Checked; info.FromUser = txtFromUser.Text; info.ToUser = txtToUser.Text; info.StartDate = Convert.ToDateTime(txtStartDate.Text); info.EndDate = Convert.ToDateTime(txtEndDate.Text + " 23:59:59.998"); info.CreateDate = System.DateTime.Now; info.CreatedByUser = CurrentUser; info.Remark = txtRemark.Text; info.State = "1"; bool result = bll.CreateDelegation(info); //Page.ClientScript.RegisterStartupScript(Page.GetType(), "ss", "alert('添加代理成功成功');", true); if (result) { //MessageBox.Show(this.Page, "添加代理成功!"); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "window.parent.ymPromptclose('ok');", true); } //else if (result == "false") //{ // MessageBox.Show(this.Page, "添加代理失败!"); //} //else if (result == "falsecontain") //{ // MessageBox.Show(this.Page, "添加代理失败!<br/><br/>在此时间段存在您已经选择过" + GetEmployeeNameByAd(tdele.Deligationor) + "作为代理人的流程,不能重复代理!"); //} //else if (result == "falserecursive" || result == "falseall") //{ // MessageBox.Show(this.Page, "添加代理失败!<br/><br/>在此时间段存在您已经被选为代理人的流程,不能再选" + GetEmployeeNameByAd(tdele.Deligationor) + "作为代理人了!"); //} }
public bool CreateDelegation(DelegationInfo info) { return(dal.CreateDelegation(info)); }