bool SaveData() { Easy_PostData MyPostData = new Easy_PostData(); MyPostData.InitClass(DS, Meta.Conn); return(MyPostData.DO_POST()); }
bool AggiungiUtenteAGruppoOrganigramma(string idcustomuser, string login) { //Aggiunge la riga in customuser ove necessario DataTable tCustomUser = Conn.RUN_SELECT("customuser", "*", null, QHS.CmpEq("idcustomuser", idcustomuser), null, false); if (tCustomUser.Rows.Count == 0) { Conn.SQLRunner("insert into customuser(idcustomuser,lt,lu,ct,cu,username) values " + "(" + QHS.List(idcustomuser, DateTime.Now, "flowchartmassive", DateTime.Now, "flowchartmassive", login) + ")", true); } else { Conn.SQLRunner("update customuser set username="******" WHERE " + QHS.CmpEq("idcustomuser", idcustomuser), true); } CheckEsistenzaGruppoOrganigramma(); DataTable tCustomGroup = DataAccess.CreateTableByName(Meta.Conn, "customgroup", "*"); DataTable tSecurityVar = DataAccess.CreateTableByName(Meta.Conn, "securityvar", "*"); DataTable tCustomUserGroup = DataAccess.CreateTableByName(Meta.Conn, "customusergroup", "*"); DataTable tUserEnvironment = DataAccess.CreateTableByName(Meta.Conn, "userenvironment", "*"); DataAccess.RUN_SELECT_INTO_TABLE(Meta.Conn, tCustomGroup, null, QHS.CmpEq("idcustomgroup", "ORGANIGRAMMA"), null, true); fillUserInGroup(idcustomuser, tCustomGroup, tCustomUserGroup); // Fill della tabella securityvar DataAccess.RUN_SELECT_INTO_TABLE(Meta.Conn, tSecurityVar, null, null, null, true); fillUserEnvironment(idcustomuser, tSecurityVar, tUserEnvironment); DataSet dsPost = new DataSet(); dsPost.Tables.Add(tCustomUserGroup); dsPost.Tables.Add(tUserEnvironment); Easy_PostData pd = new Easy_PostData(); pd.InitClass(dsPost, Meta.Conn); if (!pd.DO_POST()) { MessageBox.Show(this, "Errore nel salvataggio dei dati in AggiungiUtenteAGruppoOrganigramma", "Errore"); return(false); } else { return(true); } }
private void btnApplica_Click(object sender, EventArgs e) { if (Meta.IsEmpty) { return; } if (Meta.InsertMode) { return; } if (DS.customuser.Rows.Count == 0) { return; } QueryHelper QHS = Meta.Conn.GetQueryHelper(); DataRow Curr = DS.customuser.Rows[0]; DataTable tCustomGroup = DataAccess.CreateTableByName(Meta.Conn, "customgroup", "*"); DataTable tSecurityVar = DataAccess.CreateTableByName(Meta.Conn, "securityvar", "*"); DataTable tCustomUserGroup = DataAccess.CreateTableByName(Meta.Conn, "customusergroup", "*"); DataTable tUserEnvironment = DataAccess.CreateTableByName(Meta.Conn, "userenvironment", "*"); DataAccess.RUN_SELECT_INTO_TABLE(Meta.Conn, tCustomGroup, null, QHS.CmpEq("idcustomgroup", "ORGANIGRAMMA"), null, true); fillUserInGroup(Curr["idcustomuser"], tCustomGroup, tCustomUserGroup); // Fill della tabella securityvar DataAccess.RUN_SELECT_INTO_TABLE(Meta.Conn, tSecurityVar, null, null, null, true); fillUserEnvironment(Curr["idcustomuser"], tSecurityVar, tUserEnvironment); DataSet dsPost = new DataSet(); dsPost.Tables.Add(tCustomUserGroup); dsPost.Tables.Add(tUserEnvironment); Easy_PostData pd = new Easy_PostData(); pd.InitClass(dsPost, Meta.Conn); if (!pd.DO_POST()) { MessageBox.Show(this, "Errore nel salvataggio dei dati", "Errore"); } else { MessageBox.Show(this, "Procedura di Applicazione dell'utente effettuata", "Ok"); } }
/// <summary> /// Aggiunge un utente al gruppo organigramma e poi lo collega ad uno specifico nodo dell'organigramma stesso /// </summary> /// <param name="FlowChartUserToAdd"></param> /// <returns></returns> bool AggiungiUtenteAdOrganigramma(FlowChartUser FlowChartUserToAdd) { MetaData meta_flowchartuser = Meta.Dispatcher.Get("flowchartuser"); string idcustomuser = FlowChartUserToAdd.idcustomuser; string login = idcustomuser; // assunzione base bool res = AggiungiUtenteAGruppoOrganigramma(idcustomuser, login); if (!res) { return(false); } object idflowchart = Conn.DO_READ_VALUE("flowchart", QHS.AppAnd(QHS.CmpEq("codeflowchart", FlowChartUserToAdd.flowchartcode), QHS.CmpEq("ayear", Conn.GetSys("esercizio"))) , "idflowchart"); if (idflowchart == null || idflowchart == DBNull.Value) { MessageBox.Show(this, "Il codice " + FlowChartUserToAdd.flowchartcode + " non è presente nella tabella organigramma dell'anno " + Conn.GetSys("esercizio").ToString() + ".", "Errore"); return(false); } string f = QHS.AppAnd(QHS.CmpEq("idcustomuser", idcustomuser), QHS.CmpEq("idflowchart", idflowchart), QHS.CmpEq("title", FlowChartUserToAdd.title)); if (Conn.RUN_SELECT_COUNT("flowchartuser", f, false) > 0) { return(true); //già presente } DataTable TFlowchartUser = Conn.CreateTableByName("flowchartuser", "*"); DataSet D = new DataSet(); D.Tables.Add(TFlowchartUser); MetaData.SetDefault(TFlowchartUser, "idflowchart", idflowchart); MetaData.SetDefault(TFlowchartUser, "idcustomuser", idcustomuser); meta_flowchartuser.SetDefaults(TFlowchartUser); DataRow fu = meta_flowchartuser.Get_New_Row(null, TFlowchartUser); fu["title"] = FlowChartUserToAdd.title; fu["idsor01"] = FlowChartUserToAdd.idsor01; fu["idsor02"] = FlowChartUserToAdd.idsor02; fu["idsor03"] = FlowChartUserToAdd.idsor03; fu["idsor04"] = FlowChartUserToAdd.idsor04; fu["idsor05"] = FlowChartUserToAdd.idsor05; fu["all_sorkind01"] = FlowChartUserToAdd.all_sorkind01; fu["all_sorkind02"] = FlowChartUserToAdd.all_sorkind02; fu["all_sorkind03"] = FlowChartUserToAdd.all_sorkind03; fu["all_sorkind04"] = FlowChartUserToAdd.all_sorkind04; fu["all_sorkind05"] = FlowChartUserToAdd.all_sorkind05; fu["sorkind01_withchilds"] = FlowChartUserToAdd.sorkind01_withchilds; fu["sorkind02_withchilds"] = FlowChartUserToAdd.sorkind02_withchilds; fu["sorkind03_withchilds"] = FlowChartUserToAdd.sorkind03_withchilds; fu["sorkind04_withchilds"] = FlowChartUserToAdd.sorkind04_withchilds; fu["sorkind05_withchilds"] = FlowChartUserToAdd.sorkind05_withchilds; fu["flagdefault"] = FlowChartUserToAdd.flagdefault; fu["start"] = FlowChartUserToAdd.start == DBNull.Value? new DateTime(1900, 1, 1): FlowChartUserToAdd.start; Easy_PostData pd = new Easy_PostData(); pd.InitClass(D, Conn); if (!pd.DO_POST()) { MessageBox.Show(this, "Errore nel salvataggio dei dati in AggiungiUtenteAdOrganigramma", "Errore"); return(false); } else { return(true); } }