三层架构 看不清直接上传代码不好 上传个这么大的图片。。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 namespace ProjectManager.BLL.LM.EM{ /// <summary> /// EmployeeOperate /// </summary> public class EmployeeOperate : IEmployeeOperate { private const string PAGEID = "EmployeeOperate"; #region EmployeeOperate Members public DataSet GetEmployeeInfoList() { try { return DbHelper.ExecuteDataSet(PAGEID, "Sql001"); } catch (Exception ex) { Handler.WriteErrorLog(ex.ToString()); throw ; } } public void InsertEmployee(Entity_HX_EMPLOYEE obj, Entity_HX_ROLE obj1) { Database dbKanban = null; DbConnection con = null; DbTransaction trans = null; ArrayList paramlist = Handler.GetParamList(obj); ArrayList paramlist1 = Handler.GetParamList(obj1); //remove param id paramlist1.RemoveAt(0); try { dbKanban = DatabaseFactory.CreateDatabase(); con = dbKanban.CreateConnection(); con.Open(); trans = con.BeginTransaction(); DbHelper.ExecuteNonQuery(PAGEID, "Sql002", paramlist); DbHelper.ExecuteNonQuery(PAGEID, "Sql005", paramlist1); trans.Commit(); } catch(SqlException ex) { trans.Rollback(); if (ex.ErrorCode == -2146232060) { throw new ThrowSoapException().GetSoapExceptionInstance(ex.Message, BusinessConst.EXCEPTION_PRIMARY_REPEAT); } } //Save Employee Logo To Server UpLoadEmployeeLogo(paramlist); //UpdateEmployeeImage // UpdateEmployeeImage(paramlist); } private void UpLoadEmployeeLogo(ArrayList paramlist) { byte[] imgLogo = paramlist[paramlist.Count - 2] as byte[]; string filePath = HttpContext.Current.Server.MapPath(".") + "\\Logo\\"; if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } string employeeId = paramlist[0] as string; string fileName = filePath + employeeId + ".jpg"; if (File.Exists(fileName)) { FileInfo fn = new FileInfo(fileName); if (fn.IsReadOnly) { fn.IsReadOnly = false; } } File.WriteAllBytes(fileName, imgLogo); } 不会每句都要解释吧,还是? wondow form窗体 同时处理多个表中的数据,必须用事务处理吗? vs2005里的类文件在那个文件夹~(c#) 高人求教! 用vs c#开发,数据库oracle 9i,用户表的用户名如SupEr,查询时用super或SUPER都不能查询,求解 Listbox送分! ImageLockMode枚举问题…… 请教一段xml的写法。 请问一个常量变量的问题(急) 關於c#的網絡編程!?謝了! magicajax调用前台js脚本的问题 请教函数怎么互斥访问? 大家来看看这个排序怎么实现。。。。
{
/// <summary>
/// EmployeeOperate
/// </summary>
public class EmployeeOperate : IEmployeeOperate
{
private const string PAGEID = "EmployeeOperate"; #region EmployeeOperate Members
public DataSet GetEmployeeInfoList()
{
try
{
return DbHelper.ExecuteDataSet(PAGEID, "Sql001");
}
catch (Exception ex)
{
Handler.WriteErrorLog(ex.ToString());
throw ;
} }
public void InsertEmployee(Entity_HX_EMPLOYEE obj, Entity_HX_ROLE obj1)
{ Database dbKanban = null;
DbConnection con = null;
DbTransaction trans = null; ArrayList paramlist = Handler.GetParamList(obj);
ArrayList paramlist1 = Handler.GetParamList(obj1); //remove param id
paramlist1.RemoveAt(0);
try
{
dbKanban = DatabaseFactory.CreateDatabase();
con = dbKanban.CreateConnection();
con.Open();
trans = con.BeginTransaction();
DbHelper.ExecuteNonQuery(PAGEID, "Sql002", paramlist);
DbHelper.ExecuteNonQuery(PAGEID, "Sql005", paramlist1);
trans.Commit();
}
catch(SqlException ex)
{
trans.Rollback();
if (ex.ErrorCode == -2146232060)
{
throw new ThrowSoapException().GetSoapExceptionInstance(ex.Message, BusinessConst.EXCEPTION_PRIMARY_REPEAT);
}
} //Save Employee Logo To Server
UpLoadEmployeeLogo(paramlist); //UpdateEmployeeImage
// UpdateEmployeeImage(paramlist);
} private void UpLoadEmployeeLogo(ArrayList paramlist)
{ byte[] imgLogo = paramlist[paramlist.Count - 2] as byte[];
string filePath = HttpContext.Current.Server.MapPath(".") + "\\Logo\\";
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
string employeeId = paramlist[0] as string;
string fileName = filePath + employeeId + ".jpg";
if (File.Exists(fileName))
{
FileInfo fn = new FileInfo(fileName);
if (fn.IsReadOnly)
{
fn.IsReadOnly = false;
}
}
File.WriteAllBytes(fileName, imgLogo);
}