本文整理汇总了C#中UpsilabEntities.ExecuteStoreCommand方法的典型用法代码示例。如果您正苦于以下问题:C# UpsilabEntities.ExecuteStoreCommand方法的具体用法?C# UpsilabEntities.ExecuteStoreCommand怎么用?C# UpsilabEntities.ExecuteStoreCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UpsilabEntities
的用法示例。
在下文中一共展示了UpsilabEntities.ExecuteStoreCommand方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateType
public static void UpdateType(Guid idLABModel, bool isPP)
{
using (UpsilabEntities db = new UpsilabEntities())
{
var labModel = db.LABModel.Where(lm => lm.idLABModel == idLABModel).FirstOrDefault();
if (labModel != null)
{
labModel.IsPP = isPP;
labModel.idRisk = null;
labModel.idVigilance = null;
db.SaveChanges();
}
//Supprimer les réponses enregistrés ??
db.ExecuteStoreCommand(string.Format("DELETE FROM LABAnswerModel WHERE idLABModel= '{0}'", idLABModel));
}
}
示例2: DeleteFirmInstitution
public static Boolean DeleteFirmInstitution(Data.Model.FirmInstitution firm)
{
try
{
using (UpsilabEntities context = new UpsilabEntities())
{
//3 Supprimer les FirmInstitutionOptionValue
context.ExecuteStoreCommand(string.Format("DELETE FROM FirmInstitutionOptionAttributeValue WHERE idFirmInstitution= '{0}'", firm.idFirmInstitution));
//4 Supprimer les FirmInstitutionOptionAttributeValue
context.ExecuteStoreCommand(string.Format("DELETE FROM FirmInstitutionOptionValue WHERE idFirmInstitution= '{0}'", firm.idFirmInstitution));
//5 Suppriemr le FirmInstitution
context.ExecuteStoreCommand(string.Format("DELETE FROM FirmInstitution WHERE idFirmInstitution= '{0}'", firm.idFirmInstitution));
}
return true;
}
catch (Exception ex)
{
Log.Log.AppendException(ex);
return false;
}
}
示例3: ReassignData
public static void ReassignData(Guid oldFirm, Guid newFirm)
{
try
{
using (UpsilabEntities context = new UpsilabEntities())
{
//1 Réaffecter les client/customers
context.ExecuteStoreCommand(string.Format("UPDATE CustomerProspect SET idFirmInstitution= '{0}' WHERE idFirmInstitution= '{1}'", newFirm, oldFirm));
//2 Réaffecter les FirmInstitutionAdviser
context.ExecuteStoreCommand(string.Format("UPDATE FirmInstitutionAdviser SET idFirmInstitution= '{0}' WHERE idFirmInstitution= '{1}'", newFirm, oldFirm));
}
}
catch
{
}
}
示例4: Deleteoperation
public ActionResult Deleteoperation(string id)
{
try
{
int idop = 0;
Int32.TryParse(id, out idop);
bool isValorisation = false;
bool isOpdeleted = false;
Guid idAgregCgp = SessionManager.GetUserSession().idAgregCGP.Value;
ag_upsideo_cgp agregcgp = AgregCgpBL.GetCgpById(idAgregCgp);
int idCompte = 0;
SessionManager.Get<int>(agupsideocompteBL.AgregCompteIdSessionKey, out idCompte);
using (UpsilabEntities db = new UpsilabEntities())
{
ag_upsideo_cptrelsupports cptsupport;
ag_upsideo_cptrelsupports_histo cptsupporthisto;
ag_upsideo_operation op = db.ag_upsideo_operation.Where(o => o.idop == idop).FirstOrDefault();
if (op != null)
{
op.deleted = "o";
//save
db.SaveChanges();
//op.dateope = DateTime.Now;
isValorisation = (!string.IsNullOrEmpty(op.action) && op.action.ToLower() == "valoriser") ? true : false;
if (op.idfrontsupport != 0 && isValorisation)
{
double qteavantoperation = 0;
double qteoperation = 0;
double vlderniereoperation = 0;
double vloperation = 0;
cptsupport = db.ag_upsideo_cptrelsupports.Include("ag_upsideo_support").Where(c => c.Idfrontcompte == op.Idfrontcompte && c.idfrontsupport == op.idfrontsupport).FirstOrDefault();
cptsupporthisto = db.ag_upsideo_cptrelsupports_histo.Where(c => c.idfrontcompte == op.Idfrontcompte && c.idfrontsupport == op.idfrontsupport).FirstOrDefault();
if (cptsupport != null && cptsupporthisto != null)
{
//update
//maj pru
qteavantoperation = cptsupport.qte.HasValue ? cptsupport.qte.Value : 0;
qteoperation = op.qte.HasValue ? op.qte.Value : 0;
vlderniereoperation = cptsupporthisto.vl.HasValue ? cptsupporthisto.vl.Value : 0;
//vloperation = (cptsupport.ag_upsideo_support != null && cptsupport.ag_upsideo_support.vl.HasValue) ? cptsupport.ag_upsideo_support.vl.Value : 0;
vloperation = op.vl.HasValue ? op.vl.Value : 0;
if (op.libelleoperation.ToLower().Contains("vente"))
{
cptsupport.pru = ((qteavantoperation * vlderniereoperation) + (qteoperation * vloperation)) / (qteavantoperation + qteoperation);
}
else
{
cptsupport.pru = (qteavantoperation == qteoperation)? 0 : ((qteavantoperation * vlderniereoperation) - (qteoperation * vloperation)) / (qteavantoperation - qteoperation);
}
//maj qté
if (op.libelleoperation.ToLower().Contains("vente") && op.qte.HasValue && cptsupport.qte.HasValue)
{
cptsupport.qte = (cptsupport.qte.HasValue ? cptsupport.qte.Value : 0) + (op.qte.HasValue ? op.qte.Value : 0);
}
else if (op.qte.HasValue && cptsupport.qte.HasValue)
{
cptsupport.qte = (cptsupport.qte.HasValue ? cptsupport.qte.Value : 0) - (op.qte.HasValue ? op.qte.Value : 0);
}
cptsupport.datemaj = DateTime.Now;
//update pru liquidité
double montanthorsfrais = (op.qte.HasValue ? op.qte.Value : 0) * (op.vl.HasValue ? op.vl.Value : 0);
double liquidite = 0;
if (op.libelleoperation.ToLower().Contains("vente"))
{
liquidite = -montanthorsfrais * (1 + (op.frais.HasValue ? op.frais.Value : 0) / 100);//txtmontanthorsfrais * (1 + txtfrais / 100);
}
else
{
liquidite = montanthorsfrais * (1 - (op.frais.HasValue ? op.frais.Value : 0) / 100);//txtmontanthorsfrais * (1 - txtfrais / 100);
}
//voir si le cabinet a un fond fictif (nomsupport = Liquidités)
ag_upsideo_support supportfictif = db.ag_upsideo_support.Where(s => s.idcrmcabinet == agregcgp.idcrmcabinet && s.nomsupport == "Liquidités" && (s.deleted == null || (s.deleted != null && s.deleted == "n"))).FirstOrDefault();
//si support fictif existe
if (supportfictif != null)
{
ag_upsideo_cptrelsupports relationfictif = db.ag_upsideo_cptrelsupports.Where(s => s.Idfrontcompte == op.Idfrontcompte && s.idfrontsupport == supportfictif.idfrontsupport).FirstOrDefault();
if (relationfictif != null)
{
relationfictif.pru = relationfictif.pru + liquidite;
relationfictif.qte = 1;
}
}
//fin liquidité
}
}
//save
db.SaveChanges();
//après chaque opération , lancer la proc frontalweb_majtotalcompte
db.ExecuteStoreCommand("exec agreg.frontalweb_majtotalcompte @idcrmcabinet,@idfrontcompte", new SqlParameter("@idcrmcabinet", agregcgp.idcrmcabinet), new SqlParameter("@idfrontcompte", idCompte));
isOpdeleted = true;
}
}
if (isOpdeleted)
{
//.........这里部分代码省略.........
示例5: InsertOperation
//.........这里部分代码省略.........
vl = cptsupportnow.ag_upsideo_support.vl,
mtfondeuro = mtfondeuro
};
db.ag_upsideo_cptrelsupports_histo.AddObject(cptsupporthistonow);
}
}
//si un nouveau relation (pas encore dans la table relation)
if (isNewRelation)
{
if (support.vl.HasValue
&& support.vl.Value > 0
&& cptsupport.qte.HasValue
&& cptsupport.qte.Value > 1)
{
mtfondeuro = cptsupport.qte.Value * cptsupport.ag_upsideo_support.vl.Value;
}
else
{
mtfondeuro = cptsupport.pru.HasValue ? cptsupport.pru.Value : 0;
}
ag_upsideo_cptrelsupports_histo cptsupporthistofornewrelation = new ag_upsideo_cptrelsupports_histo()
{
datehisto = DateTime.Now,
datemaj = DateTime.Now,
idfrontcompte = cptsupport.Idfrontcompte,
idfrontsupport = cptsupport.idfrontsupport,
qte = cptsupport.qte,
pru = cptsupport.pru,
vl = support.vl,
mtfondeuro = mtfondeuro
};
db.ag_upsideo_cptrelsupports_histo.AddObject(cptsupporthistofornewrelation);
}
//fin histo ag_upsideo_cptrelsupports_histo
}
//save
db.SaveChanges();
//après chaque opération , lancer la proc frontalweb_majtotalcompte (pour valorisé compte)
if (_operation.idfrontsupport != 0 && isValorisation)
{
Guid idClient = Guid.Empty;
SessionManager.Get<Guid>(agupsideocompteBL.AgregClientIdSessionKey, out idClient);
db.CommandTimeout = 180;
db.ExecuteStoreCommand("exec agreg.frontalweb_majtotalcompte @idcrmcabinet,@idfrontcompte", new SqlParameter("@idcrmcabinet", cgpagreg.idcrmcabinet), new SqlParameter("@idfrontcompte", idCompte));
//save
db.SaveChanges();
}
}
if (_operation.idfrontsupport != 0 && isValorisation)
{
using (UpsilabEntities db = new UpsilabEntities())
{
//compte aprés maj
ag_upsideo_compte compteahistoriser = db.ag_upsideo_compte.Where(c => c.Idfrontcompte == idCompte && (c.deleted == null || (c.deleted != null && c.deleted == "n"))).FirstOrDefault();
//historisé dans ag_upsideo_compte_histo
ag_upsideo_compte_histo cpthisto = db.ag_upsideo_compte_histo.Where(h => h.idfrontcompte == idCompte
&& h.datehisto.Year == DateTime.Now.Year
&& h.datehisto.Month == DateTime.Now.Month
&& h.datehisto.Day == DateTime.Now.Day).FirstOrDefault();
if (cpthisto != null)
{
cpthisto.datehisto = DateTime.Now;
cpthisto.totalcompte = compteahistoriser.totalcompte.Value;
}
else
{
ag_upsideo_compte_histo cpthistonew = new ag_upsideo_compte_histo()
{
datehisto = DateTime.Now,
idfrontcompte = compteahistoriser.Idfrontcompte,
devise = string.IsNullOrEmpty(compteahistoriser.devise) ? "EUR" : compteahistoriser.devise,
totalcompte = compteahistoriser.totalcompte.HasValue ? compteahistoriser.totalcompte.Value : 0
};
//insert
db.ag_upsideo_compte_histo.AddObject(cpthistonew);
}
//save
db.SaveChanges();
//fin historisation
}
}
}
catch (Exception ex)
{
ViewBag.Style = "style=color:red";
ViewBag.Message = "Erreur: " + ex.Message;
Upsilab.Business.Log.Log.AppendException(ex);
}
return RedirectToAction("Index", new { id = idCompte });
}
示例6: Deletemvmt
public ActionResult Deletemvmt(string id)
{
int idCompte = 0;
SessionManager.Get<int>(agupsideocompteBL.AgregCompteIdSessionKey, out idCompte);
int idmvmt = 0;
Int32.TryParse(id, out idmvmt);
Guid idAgregCgp = SessionManager.GetUserSession().idAgregCGP.Value;
ag_upsideo_cgp agregcgp = AgregCgpBL.GetCgpById(idAgregCgp);
try
{
ag_upsideo_compte compte;
bool isValorisation = false;
using (UpsilabEntities db = new UpsilabEntities())
{
ag_upsideo_mouvement _mvmt = db.ag_upsideo_mouvement.Where(m => m.idmouv == idmvmt).FirstOrDefault();
//new
if (_mvmt.libellemouvement.ToLower().Equals("souscription")
|| _mvmt.libellemouvement.ToLower().Equals("coupon")
|| _mvmt.libellemouvement.ToLower().Equals("remboursement")
|| _mvmt.libellemouvement.ToLower() == "participation aux bénéfices"
|| _mvmt.libellemouvement.ToLower() == "participation benefice"
|| _mvmt.libellemouvement.ToLower() == "régulation historique"
|| _mvmt.libellemouvement.ToLower() == "transfert"
|| _mvmt.libellemouvement.ToLower().Equals("souscription/adhésion/ouverture de compte")
|| _mvmt.libellemouvement.ToLower().Contains("versement"))
{
_mvmt.montantnet = _mvmt.montantnet.HasValue ? _mvmt.montantnet.Value : 0;
}
else
{
_mvmt.montantnet = _mvmt.montantnet.HasValue ? -Math.Abs(_mvmt.montantnet.Value) : 0;
}
//
compte = db.ag_upsideo_compte.Where(c => c.Idfrontcompte == idCompte && (c.deleted == null || (c.deleted != null && c.deleted == "n"))).FirstOrDefault();
if (_mvmt != null)
{
_mvmt.deleted = "o";
//save
db.SaveChanges();
//mvmt.datemvt = DateTime.Now;
isValorisation = (!string.IsNullOrEmpty(_mvmt.action) && _mvmt.action.ToLower() == "valoriser") ? true : false;
if (isValorisation && compte != null)
{
string libellemouvement = _mvmt.libellemouvement.ToLower();
double pru = 0;
pru = _mvmt.montantnet.HasValue ? _mvmt.montantnet.Value : 0;
//voir si le cabinet a un fond fictif (nomsupport = Liquidités)
ag_upsideo_support support = db.ag_upsideo_support.Where(s => s.idcrmcabinet == agregcgp.idcrmcabinet && s.nomsupport == "Liquidités" && (s.deleted == null || (s.deleted != null && s.deleted == "n"))).FirstOrDefault();
if (support != null)
{
ag_upsideo_cptrelsupports relation = db.ag_upsideo_cptrelsupports.Where(s => s.Idfrontcompte == compte.Idfrontcompte && s.idfrontsupport == support.idfrontsupport).FirstOrDefault();
relation.pru = relation.pru + pru;
//save
db.SaveChanges();
db.CommandTimeout = 180;
db.ExecuteStoreCommand("exec agreg.frontalweb_majtotalcompte @idcrmcabinet,@idfrontcompte", new SqlParameter("@idcrmcabinet", agregcgp.idcrmcabinet), new SqlParameter("@idfrontcompte", idCompte));
//save
db.SaveChanges();
}
}
}
}
//historiser
if (isValorisation && compte != null)
{
using (UpsilabEntities db = new UpsilabEntities())
{
//compte aprés maj
ag_upsideo_compte compteahistoriser = db.ag_upsideo_compte.Where(c => c.Idfrontcompte == idCompte && (c.deleted == null || (c.deleted != null && c.deleted == "n"))).FirstOrDefault();
//historisé dans ag_upsideo_compte_histo
ag_upsideo_compte_histo cpthisto = db.ag_upsideo_compte_histo.Where(h => h.idfrontcompte == idCompte
&& h.datehisto.Year == DateTime.Now.Year
&& h.datehisto.Month == DateTime.Now.Month
&& h.datehisto.Day == DateTime.Now.Day).FirstOrDefault();
if (cpthisto != null)
{
cpthisto.datehisto = DateTime.Now;
cpthisto.totalcompte = compteahistoriser.totalcompte.Value;
}
else
{
ag_upsideo_compte_histo cpthistonew = new ag_upsideo_compte_histo()
{
datehisto = DateTime.Now,
idfrontcompte = compteahistoriser.Idfrontcompte,
devise = string.IsNullOrEmpty(compteahistoriser.devise) ? "EUR" : compteahistoriser.devise,
totalcompte = compteahistoriser.totalcompte.HasValue ? compteahistoriser.totalcompte.Value : 0
};
//insert
db.ag_upsideo_compte_histo.AddObject(cpthistonew);
}
//save
db.SaveChanges();
//.........这里部分代码省略.........
示例7: InsertMvmt
//.........这里部分代码省略.........
ag_upsideo_support support = db.ag_upsideo_support.Where(s => s.idcrmcabinet == agregcgp.idcrmcabinet && s.nomsupport == "Liquidités" && (s.deleted == null || (s.deleted != null && s.deleted == "n"))).FirstOrDefault();
//crée un support si n'existe pas
if (support == null)
{
ag_upsideo_referentiel referentiel = db.ag_upsideo_referentiel.Where(r => r.nomsupport == "Liquidités").OrderByDescending(o => o.datevl).FirstOrDefault();
support = new ag_upsideo_support()
{
idrefsupport = referentiel.idrefsupport,
idcrmcabinet = agregcgp.idcrmcabinet,
idsg = -1,
idtypesupport = -1,
nomsupport = referentiel.nomsupport,
datevl = referentiel.datevl,
devise = referentiel.devise,
deleted = "n",
vl = 0,
};
support = AgregSupportBL.AddObjetcSupport(support);
}
else
{
support.deleted = "n";
support.vl = 0;
}
ag_upsideo_cptrelsupports relation = db.ag_upsideo_cptrelsupports.Where(s => s.Idfrontcompte == compte.Idfrontcompte && s.idfrontsupport == support.idfrontsupport).FirstOrDefault();
if (relation == null)
{
relation = new ag_upsideo_cptrelsupports()
{
Idfrontcompte = compte.Idfrontcompte,
idfrontsupport = support.idfrontsupport,
pru = pru,
qte = 1,
datemaj = DateTime.Now
};
db.ag_upsideo_cptrelsupports.AddObject(relation);
}
else
{
relation.pru = relation.pru + pru;
relation.qte = 1;
}
//save
db.SaveChanges();
db.CommandTimeout = 180;
db.ExecuteStoreCommand("exec agreg.frontalweb_majtotalcompte @idcrmcabinet,@idfrontcompte", new SqlParameter("@idcrmcabinet", agregcgp.idcrmcabinet), new SqlParameter("@idfrontcompte", idCompte));
//save
db.SaveChanges();
}
}
if (isValorisation && compte != null)
{
using (UpsilabEntities db = new UpsilabEntities())
{
//compte aprés maj
ag_upsideo_compte compteahistoriser = db.ag_upsideo_compte.Where(c => c.Idfrontcompte == idCompte && (c.deleted == null || (c.deleted != null && c.deleted == "n"))).FirstOrDefault();
//historisé dans ag_upsideo_compte_histo
ag_upsideo_compte_histo cpthisto = db.ag_upsideo_compte_histo.Where(h => h.idfrontcompte == idCompte
&& h.datehisto.Year == DateTime.Now.Year
&& h.datehisto.Month == DateTime.Now.Month
&& h.datehisto.Day == DateTime.Now.Day).FirstOrDefault();
if (cpthisto != null)
{
cpthisto.datehisto = DateTime.Now;
cpthisto.totalcompte = compteahistoriser.totalcompte.Value;
}
else
{
ag_upsideo_compte_histo cpthistonew = new ag_upsideo_compte_histo()
{
datehisto = DateTime.Now,
idfrontcompte = compteahistoriser.Idfrontcompte,
devise = string.IsNullOrEmpty(compteahistoriser.devise) ? "EUR" : compteahistoriser.devise,
totalcompte = compteahistoriser.totalcompte.HasValue ? compteahistoriser.totalcompte.Value : 0
};
//insert
db.ag_upsideo_compte_histo.AddObject(cpthistonew);
}
//save
db.SaveChanges();
//fin historisation
}
}
}
catch (Exception ex)
{
ViewBag.Style = "style=color:red";
ViewBag.Message = "Erreur: " + ex.Message;
}
return RedirectToAction("Index", new { id = idCompte });
}
示例8: UpdateSupport
//.........这里部分代码省略.........
{
cptsupporthistonow = new ag_upsideo_cptrelsupports_histo()
{
datehisto = DateTime.Now,
datemaj = DateTime.Now,
idfrontcompte = cptsupportnow.Idfrontcompte,
idfrontsupport = cptsupportnow.idfrontsupport,
qte = cptsupportnow.qte,
pru = cptsupportnow.pru,
vl = cptsupportnow.ag_upsideo_support.vl,
mtfondeuro = mtfondeuro
};
db.ag_upsideo_cptrelsupports_histo.AddObject(cptsupporthistonow);
}
}
//si un nouveau relation (pas encore dans la table relation)
if (isNewRelation)
{
if (cptsupport.ag_upsideo_support != null
&& cptsupport.ag_upsideo_support.vl.HasValue
&& cptsupport.ag_upsideo_support.vl.Value > 0
&& cptsupport.qte.HasValue
&& cptsupport.qte.Value > 1)
{
mtfondeuro = cptsupport.qte.Value * cptsupport.ag_upsideo_support.vl.Value;
}
else
{
mtfondeuro = cptsupport.pru.HasValue ? cptsupport.pru.Value : 0;
}
ag_upsideo_cptrelsupports_histo cptsupporthistofornewrelation = new ag_upsideo_cptrelsupports_histo()
{
datehisto = DateTime.Now,
datemaj = DateTime.Now,
idfrontcompte = cptsupport.Idfrontcompte,
idfrontsupport = cptsupport.idfrontsupport,
qte = cptsupport.qte,
pru = cptsupport.pru,
vl = cptsupport.ag_upsideo_support.vl.Value,
mtfondeuro = mtfondeuro
};
db.ag_upsideo_cptrelsupports_histo.AddObject(cptsupporthistofornewrelation);
}
//fin histo ag_upsideo_cptrelsupports_histo
//save
db.SaveChanges();
//après chaque opération , lancer la proc frontalweb_majtotalcomptecpts
db.CommandTimeout = 180;
db.ExecuteStoreCommand("exec agreg.frontalweb_majtotalcompte @idcrmcabinet,@idfrontcompte", new SqlParameter("@idcrmcabinet", cgpagreg.idcrmcabinet), new SqlParameter("@idfrontcompte", idCompte));
}
using (UpsilabEntities db = new UpsilabEntities())
{
//compte aprés maj
ag_upsideo_compte compteahistoriser = db.ag_upsideo_compte.Where(c => c.Idfrontcompte == idCompte && (c.deleted == null || (c.deleted != null && c.deleted == "n"))).FirstOrDefault();
//historisé dans ag_upsideo_compte_histo
ag_upsideo_compte_histo cpthisto = db.ag_upsideo_compte_histo.Where(h => h.idfrontcompte == idCompte
&& h.datehisto.Year == DateTime.Now.Year
&& h.datehisto.Month == DateTime.Now.Month
&& h.datehisto.Day == DateTime.Now.Day).FirstOrDefault();
if (cpthisto != null)
{
cpthisto.datehisto = DateTime.Now;
cpthisto.totalcompte = compteahistoriser.totalcompte.Value;
}
else
{
ag_upsideo_compte_histo cpthistonew = new ag_upsideo_compte_histo()
{
datehisto = DateTime.Now,
idfrontcompte = compteahistoriser.Idfrontcompte,
devise = string.IsNullOrEmpty(compteahistoriser.devise) ? "EUR" : compteahistoriser.devise,
totalcompte = compteahistoriser.totalcompte.HasValue ? compteahistoriser.totalcompte.Value : 0
};
//insert
db.ag_upsideo_compte_histo.AddObject(cpthistonew);
}
//save
db.SaveChanges();
//fin historisation
}
}
catch (Exception ex)
{
Upsilab.Business.Log.Log.AppendException(ex);
ViewBag.Message = "Erreur: " + ex.Message;
AgregCompteDetail agregcomptedetail = new AgregCompteDetail();
agregcomptedetail.AgregCompteDetailList = agupsideocompteBL.GetCompteDetail(idCompte);
agregcomptedetail.AgregCompte = agupsideocompteBL.GetComptesByIdCompte(idCompte);
agregcomptedetail.SoldeEspece = agupsideocompteBL.SoldeEspece(idCompte);
return View("CompteDetail", agregcomptedetail);
}
return RedirectToAction("CompteDetail", new { id = idCompte });
}