public string InsertTargetHeader(FormCollection collection) { string fromDate = "", toDate = ""; if (!string.IsNullOrEmpty(collection["From"].ToString())) { fromDate = Convert.ToDateTime(collection["From"].ToString()).ToString("yyyy-MM-dd"); } if (!string.IsNullOrEmpty(collection["To"].ToString())) { toDate = Convert.ToDateTime(collection["To"].ToString()).ToString("yyyy-MM-dd"); } string result = _objSP.InsertTargetHeader("SP_hdInsertTargetHeader", collection["TargetName"].ToString(), collection["RegionCode"].ToString(), fromDate, toDate, collection["Mode"].ToString(), collection["TargetCode"].ToString()); return(result); }